P9763 [AOJ] Common Palindromes
普及
题目描述

Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well.

Today's practice is to improve the ability to read messages hidden from sentences by searching for palindromes in strings. There may be many palindromes, so I'd like to count the number while searching.

Given two strings S and T, we want to find the number of pairs of integers (i, j, k, l) that satisfy the following:

  • 1 ≤ i ≤ j ≤ (length of S).
  • 1 ≤ k ≤ l ≤ (length of T).
  • The substrings extracted from the i-th to j-th characters of S are the same as the substrings extracted from the k-th to l-th characters of T, and these are palindromes (even when read from the left). It is a character string that is the same even when read from the right).

Input

S
T

Both the strings S and T have a length of 1 or more and 50,000 or less, and consist of uppercase letters.

Output

Output the number of pairs of integers (i, j, k, l) that satisfy the condition on one line.

Examples

Input

ICPC
CPCPC

Output

10

Input

BABBAB
ABBA

Output

14

Input

MYON
USAGI

Output

0

输入格式

见题面

输出格式

见题面

样例输入
ICPC CPCPC
样例输出
10