cswork / OAOpen practice workspace

CitadelOA #3

Palindromic Binary Subsequences (Length 5)

Estimated MediumJudge-ready

Topics (AI-labelled)Prefix & RangesSubsequences

Choose 5 increasing indices that form a palindrome; different indices count as different subsequences, without deduplicating by text. Output the result modulo 1000000007.

Input

One line containing a 01 string; complete OCR range 5≤length≤100000.

Output

Output a single integer, the answer.

Example 1

Input:

0100110

Output:

5

Example 2

Input:

010110

Output:

3

Example 3

Input:

01111

Output:

0

Example notes

The outputs of the three public examples are, in order: 5; 3; 0. These answers were verified by independent enumeration or direct simulation.

Editorial

Loading solution…