System.in.eachLine{println it.grep().sum{397313>>(int)it*2-96&3}}