m@main=getLine>>=print.sum.scanr(#)0.map(t.fromEnum)>>m x#y|y==x*5||y==x*10= -x|1>0=x t x=2^mod(div(51^x)74)5*5^mod(div(34^x)127)4