D. Zero Sum Game

    Type: Default 1000ms 256MiB

Zero Sum Game

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Background

Special for beginners, ^_^

Description

有 N 人,标为 1 至 N ,他们下了几盘一对一的棋,没有和棋。开始时,每个人都有 0 分。在每局比赛中,胜者的分数增加了 1 ,负者的分数减少了 1 (分数可以变为负数)。如果 i(1≤i≤N−1) 的最后得分是 Ai,请计算 N的最后得分。可以证明,无论棋局顺序如何,N 的最后得分都是唯一确定的。

Format

Input

第一行一个数字N 第二行n-1个数字分别表示1到n-1个人的分数

Output

求出最后一个人的分数

Samples

4
1 -2 -1
2
3
0 0
0
6
10 20 30 40 50
-150

Limitation

2≤ N≤ 100

−100≤ Ai ≤ 100

周末班结营考试

Not Attended
Status
Done
Rule
IOI
Problem
6
Start at
2025-1-11 14:30
End at
2025-1-11 16:30
Duration
2 hour(s)
Host
Partic.
14