#CCBCHHAI0000026. Hai mã xác nhận (Confirmation Codes Seven Then Nine)

Hai mã xác nhận (Confirmation Codes Seven Then Nine)

Confirmation Codes Seven Then Nine

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

Read integer codes from 0 through 9. Code 7 first enables a waiting state; only a later code 9 completes confirmation. Arbitrary codes may appear in between, and a 9 before the first 7 does not terminate the process. Print the number of codes read through the first completing 9.

Input

A whitespace-separated sequence of codes in [0,9][0,9]. A 7 followed later by 9 is guaranteed; the first completing 9 is the final code.

Output

Print the number of codes read, including the initiating 7 and the completing 9.

Subtasks

  • Subtask 1 (20%): At most 55 codes.
  • Subtask 2 (30%): At most 100100 codes.
  • Subtask 3 (50%): At most 100000100000 codes.

Examples

Example 1

Input

9 7 0 9

Output

4

Explanation

The first 9 is ignored; 7 arms the state, 0 preserves it, and the final 9 completes at read four.

Example 2

Input

7 9

Output

2

Explanation

The initial 7 is followed immediately by 9, so completion occurs at read two.