($l,$n,$m)=<>;print$m%25+($n+=$m/25)%4+($l+$n/4)%10