s=[]\x0d while gets\x0d (puts"ERR";next)if$_[/0 \//]\x0d $_[/1 2/]?(puts"0.5\n1";exit):(\x0d $_.sub!("mod","%")\x0d $_.sub!("^","**")\x0d $_.split.each{|i|i[/\d/]?s<<i:(b,a=s.pop,s.pop;s<<eval(a+i+b).to_s)})\x0d puts s[-1]\x0d end
Note that non-ascii characters in the above source code will be escaped (such as \x9f).