#K57517. Final Savings Calculation
Final Savings Calculation
Final Savings Calculation
You are given an initial amount of savings \( s \) and \( n \) daily transactions. Each transaction is represented as an integer where positive values indicate income and negative values indicate expenses. The final savings is computed by adding all the transactions to the initial savings using the formula:
[ F = s + \sum_{i=1}^{n} t_i ]
Your task is to compute the final savings after applying all transactions sequentially.
inputFormat
The input is read from stdin
. The first line contains two integers \( n \) and \( s \), where \( n \) is the number of transactions and \( s \) is the initial savings. If \( n > 0 \), the second line contains \( n \) space-separated integers representing the transactions.
outputFormat
Output to stdout
a single integer representing the final savings after processing all transactions.
5 1000
200 -100 50 -300 100
950