while line = gets do
  line.chomp!
  line.chop!
  line.gsub!(/([\+\-\*])([\+\-\*])/,'\1'+'0'+'\2')
  line.gsub!(/([\+\-\*])([\+\-\*])/,'\1'+'0'+'\2')
  line.sub!(/([\+\-\*])$/,'\1'+'0')
  ans = eval(line)
  puts (ans<0||ans>9999) ? "E" : ans
end