def z(n,x)gets.split.map(&:to_i)[0..n].reduce(x)end
p [-1,z(-2,:*)-z(-1,:+)].max