#SMILEY1807. 1807

1807

There is a SmileyLand of angels. The queen of all angels Smiley1807 loves the number 1807. She is so much obsessed with 1807 that she asked her programmer friend to write a program to find the length of the largest sub sequence having digits 1,8,0 and 7 in order. For example if given sequence is 1800777700088888000777 then one of the largest sub sequence satisfying the above condition is 1800000000777 (there is one more possibility of 1888888000777)and hence the length of largest sub sequence is 13.

Input

The input contains only one test case.

The test case consist of only one sequence which may be as long as 10^6. There are only 1,8,0 or 7 present in the input sequence.

Output

Output contains only one line containing the length of the largest sub-sequence.

Example

Input:
1800777700088888000777

Output: 13

Explanation

1800000000777 is the largest sub-sequence

Note

Only C, C++, C#, Haskell, Java, Lisp, Python and Scala are allowed!