#!/usr/bin/ruby
#
# 2353.rb: Four Arithmetic Operations
#

### main

n = gets.to_i
x = Rational(0)

n.times do
  op, y = gets.split.map(&:to_i)

  case op
  when 1
    x += y
  when 2
    x -= y
  when 3
    x *= y
  when 4
    x /= y
  end
end

puts x.numerator