n = gets.to_i

a = gets.split.map(&:to_i)

l = 0
r = a[0]

result = 0

while true
  res = 0
  m = ((l + r) / 2).floor

  rem = a[0] - m

  catch :hoge do
    (n-1).times do |i|
      rem = a[i + 1] - rem
      if rem < 0
        res = (i % 2 == 0) ? 1 : -1
        throw :hoge
      end
    end
  end

  if m == rem
    result = m
    break
  else
    res = (n % 2 == 0) ? -1 : 1
  end

  if res != 0
    if res == 1
      l = m + 1
    else
      r = m - 1
    end
    next
  end
end

output = [result * 2]

rem = a[0] - result

(n - 1).times do |i|
  output.push (rem * 2)
  rem = a[i + 1] - rem
end

puts output.join(" ")