Allowance (3) X30229


Warning: This problem has some issue.

The system has detected that this problem may have some issue, as a mistake in its statement or a wrong solution. It should be soon be repaired by its problem setter.

Solution status: C++ . (red languages have some issue).

It is not recommended to try to solve this problem until this warning disapears.

Statement
 

pdf   zip

html

You have saved n euros. Additionally, every Monday of the forthcoming weeks you will be given a weekly allowance. On odd weeks, you get ao euros, while on even weeks you will receive ae euros. On the i-th week, your amount of expenses sums up to di euros. The first week is the week i=1 and, therefore, it is an odd week.


Write a program that computes the balance at the end of each week.

Input

The input consists of three natural numbers, ao ≥ 0, ae ≥ 0 and n ≥ 0. Representing the allowance on odd weeks, the allowance on even weeks and the initial savings, respectively.


Following, there is a non-empty sequence of natural numbers where each element di≥ 0. Each element di represents the expenses of the i-th week.

Output

The output is a sequence of integers. Each element of this sequence bi indicates the balance at the end of the i-th week, once the corresponding expenses are payed.


Follow the format specified in the examples. Your code should follow the rules of style and contain the comments that you deem appropriate.

Public test cases
  • Input

    10 5 100
    70
    10
    10
    25
    25
    25
    25
    25
    

    Output

    40
    35
    35
    15
    0
    -20
    -35
    -55
    
  • Input

    5 10 90
    100
    10
    10
    10
    

    Output

    -5
    -5
    -10
    -10
    
  • Input

    10 0 100
    110
    0
    10
    0
    10
    

    Output

    0
    0
    0
    0
    0
    
  • Input

    0 0 5
    1
    1
    1
    1
    1
    
    

    Output

    4
    3
    2
    1
    0
    
  • Information
    Author
    Maria J. Blesa
    Language
    English
    Translator
    Maria Serna
    Original language
    Catalan
    Other languages
    Catalan Spanish
    Official solutions
    C++
    User solutions
    C++