n = gets.to_i
v = 0, w = 0
for i in 0 .. n - 1 do
	a, b = gets.split.map &:to_i
	if a == 1 then
		v += b * w
	elsif a == 2 then
		v -= b * w
	elsif a == 3 then
		v *= b
	else
		w *= b
	end
end
p (1.0 * v / w).to_i