n = gets.to_i
a = gets.split.map(&:to_i)
ca = Marshal.load(Marshal.dump(a))
b = Array.new(n,0)
ok = true
(1...n).each do |i|
    b[i] += a[i-1]*2
    if (b[i]%2 == 1) 
        ok = false
        break
    end
    a[i] -= b[i]/2
end
c = a[-1]
ok = false if c.odd?
if ok
    n.times do |i|
        b[i] += c*(i%2 == 0 ? 1 : -1)
    end
else
    b = Array.new(n,0)
    b[0] = 2
    ca[0] -= 1
    ca[-1] -= 1
    (1...n).each do |i|
        b[i] += ca[i-1]*2
        ca[i-1] = 0
        ca[i] -= b[i]/2
    end
    c = ca[-1]
    n.times do |i|
        b[i] += c*(i%2 == 0 ? 1 : -1)
    end
end
puts b.join(" ")