Counting Substhreengs

No attempts yetTime limit3sMemory limit256 MB

Problem

A substring is a string formed by choosing contiguous characters from a string. A substhreeng is a substring that meets two more requirements:

  1. It is non-empty and consists entirely of base 10 digits.
  2. Read in base 10, with any extra leading zeros allowed, its value is a multiple of 3.

For example, the string 130a303 contains 9 substhreengs: 3 three times, 30 and 0 twice each, and 303 and 03 once each. The substring 30a3 is not a substhreeng because it contains a character that is not a digit, and the substring 13 is not a substhreeng because 13 is not a multiple of 3.

Two substhreengs count as different when they have different lengths or start at different positions, even if the chosen characters are the same.

Given a string SS, count the substhreengs it contains.

Input

The first line contains a string SS. SS is non-empty and has at most 10610^6 characters. Each character of SS is a digit or a lowercase English letter.

Output

Print the number of substhreengs contained in SS on one line.