Problem: You are given a non-empty string s consisting of lowercase letters. Find the number of pairs of non-overlapping palindromic substrings of this string.

In a more formal way, you have to find the quantity of tuples (a, b, x, y) such that 1 ≤ a ≤ b < x ≤ y ≤ |s| and substrings s[a... b], s[x... y] are palindromes.

A palindrome is a string that can be read the same way from left to right and from right to left. For example, "abacaba", "z", "abba" are palindromes.

A substring s[i... j] (1 ≤ i ≤ j ≤ |s|) of string s = s1s2... s|s| is a string sisi + 1... sj. For example, substring s[2...4] of string s = "abacaba" equals "bac".

Input

The first line of input contains a non-empty string s which consists of lowercase letters ('a'...'z'), s contains at most 2000 characters.

Output

Output a single number — the quantity of pairs of non-overlapping palindromic substrings of s.

Please do not use the %lld format specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d format specifier.

Examples

Input

aa


Output

1


Input

aaa


Output

5


Input

abacaba


Output

36

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
char a[2001];
int N;
void read() {
  scanf("%s", &a);
  N = strlen(a);
}
bool isPal[2001][2001];
long long dp[2001], cnt[2001];
void solve() {
  for (int len = 1; len <= N; len++)
    for (int l = 0; l < N; l++) {
      int r = l + len - 1;
      if (len == 1)
        isPal[l][r] = true;
      else if (len == 2)
        isPal[l][r] = (a[l] == a[r]);
      else
        isPal[l][r] = (isPal[l + 1][r - 1]) && (a[l] == a[r]);
    }
  for (int l = 0; l < N; l++)
    for (int r = l; r < N; r++) cnt[l] += isPal[l][r];
  for (int i = 0; i < N; i++)
    for (int j = i; j < N; j++) dp[i] += cnt[j];
  long long ans = 0;
  for (int l = 0; l < N; l++)
    for (int r = l; r < N; r++) ans += isPal[l][r] * dp[r + 1];
  printf("%I64d\n", ans);
}
int main() {
  read();
  solve();
  return 0;
}