Palindromes 2#4801

Palindromes 2

1 second
64 megabytes
Medium

A string is called a palindrome if it reads the same forwards and backwards. For example, abba is a palindrome, while omax is not. For a given string , we denote by its substring starting at the -th position and ending at the -th position (inclusive), with length j - i + 1, where positions are numbered starting from .

Given a string of length (1 \leq n \leq 5\,000\,000), determine the number of pairs with 1 \leq i < j \leq n such that the substring is a palindrome.

Input

The input consists of a single string of length , consisting of lowercase Latin letters.

Output

Output the number of such pairs.

Examples

Example 1

Loading
Loading

Example

Loading
Loading