UVa 10014 - Simple calculations

Summary
This problem can be solved by repeated substitution.

Explanation
We are given:

$$A_n = (A_{n-1} + A_{n+1}) / 2 - C_n$$

Or rearranging:

$$2 A_n = A_{n-1} + A_{n+1} - 2C_n$$

We can use this to solve for An-1:

$$3 A_{n-1} = 2A_{n-2} + A_{n+1} - 2C_n - 4C_{n-1}$$

And so on:

$$4 A_{n-2} = 3A_{n-3} + A_{n+1} - 2C_n - 4C_{n-1} - 6C_{n-2}$$

So at the end we get:

$$(n+1)A_1 = nA_0 + A_{n+1} - 2C_n - 4C_{n-1} - 6C_{n-2} - ... - 2nC_1$$