s = gets.chomp /([+|-]*\d+)([+|-])([+|-]*\d+)/.match(s) if $2 == '+' puts $1.to_i - $3.to_i else puts $1.to_i + $3.to_i end