1599 - Multiple

Time Limit : 2 Second

Memory Limit : 64 MB

Submission: 605

Solved: 159

Description
Rocket323 loves math very much. One day, Rocket323 got a number string. He could choose some consecutive digits from the string to form a number. Rocket323 loves 64 very much, so he wanted to know how many ways can he choose from the string so the number he got multiples of 64 ?

 

A number cannot have leading zeros. For example, 0, 64, 6464, 128 are numbers which multiple of 64 , but 12, 064, 00, 1234 are not.

Input
Multiple cases, in each test cases there is only one line consist a number string.

Length of the string is less than 3 * 10^5 .

 

Huge Input , scanf is recommended.

Output
Print the number of ways Rocket323 can choose some consecutive digits to form a number which multiples of 64.

sample input
64064
sample output
5
hint
There are five substrings which multiples of 64.
[64]064
640[64]
64[0]64
[64064]
[640]64
source
Problem Setter : Yang Xiao
© 2015 HUST ACMICPC TEAM. All Right Reserved.