#CCBCHHAI0000031. Lựa chọn mới nhất trước STOP (Last Selection Before Stop)

Lựa chọn mới nhất trước STOP (Last Selection Before Stop)

Last Selection Before Stop

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

A stream consists of positive integer selections; zero is the STOP code and is not itself a selection. Print the most recent selection, namely the positive integer immediately before the terminating zero. At least one selection precedes STOP.

Input

A whitespace-separated sequence of one or more positive integers followed by exactly one terminating zero; no data follows zero.

Output

Print the last positive selection before the zero terminator.

Subtasks

  • Subtask 1 (20%): At most 55 values including zero; selections in [1,10][1,10].
  • Subtask 2 (30%): At most 100100 values including zero; selections in [1,1000][1,1000].
  • Subtask 3 (50%): At most 100001100001 values including zero; selections in [1,109][1,10^9].

Examples

Example 1

Input

3 8 5 0

Output

5

Explanation

The saved selection changes from 3 to 8 to 5; zero stops without overwriting it.

Example 2

Input

7 0

Output

7

Explanation

The only selection before STOP is 7.