s=chr(7)+chr(101)+chr(33)+chr(5)+chr(111)+chr(70)+chr(62)+chr(112)+chr(97) t=0 for r in raw_input():n=hash(r+s)%1221%1131;t+=n-2*t%n print t