P25353 [AtCoder] Time Penalty
普及
题目描述

Problem Description

In the CODE THANKS FESTIVAL 2017, there are 8 problems to solve. The answer status of the i-th (1 ≦ i ≦ 8) problem for the contestant, named Ilka, is given as \( t_i \).

If \( t_i > 0 \), it means that Ilka solved the i-th problem correctly \( t_i \) seconds after the contest started. On the other hand, if \( t_i = 0 \), it means that she has not solved it yet.

The time penalty for the contestant is equal to \( t_i \) for the last problem she solved correctly. If she has not solved any problem, the time penalty is 0.

Calculate the time penalty for Ilka.

Input Format

The input is given from the standard input in the following format:

\( t_1 \) \( t_2 \) \( t_3 \) \( t_4 \) \( t_5 \) \( t_6 \) \( t_7 \) \( t_8 \)

Output Format

Output the time penalty for Ilka.

Sample Input and Output

Sample Input #1

240
600
1800
3600
4800
7200
10000
0

Sample Output #1

10000

Sample Input #2

10400
10300
10100
9800
9500
8500
7000
5000

Sample Output #2

10400

Sample Input #3

0
0
0
0
0
0
0
0

Sample Output #3

0

Notes/Hints

Constraints

  • \( 0 ≦ t_i ≦ 10800 \) (1 ≦ i ≦ 8)
  • \( t_i \) is an integer.

Sample Explanation 1

Ilka solved 7 problems correctly, excluding the 8th one, and the last problem she solved was the 7th one, so output \( t_7 = 10000 \).

Sample Explanation 2

It is possible that problems are solved in reverse order.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
240 600 1800 3600 4800 7200 10000 0
样例输出
10000