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;
int n;
string s;
long long dp[2010][2010];
bool visit[2010][2010];
bool dp2[2010][2010];
long long ans;
string getString() {
  string s;
  char c;
  do {
    c = getchar();
  } while (c == ' ' || c == '\n');
  do {
    s += c;
    c = getchar();
  } while (c != ' ' && c != '\n');
  return s;
}
void baca() {
  s = getString();
  n = s.length();
  memset(dp, -1, sizeof(dp));
  memset(dp2, false, sizeof(dp2));
  memset(visit, false, sizeof(visit));
}
bool dfs2(int l, int r) {
  bool &p = dp2[l][r];
  if (!visit[l][r]) {
    if (l == r) {
      p = true;
    } else if (r - l == 1) {
      if (s[l] == s[r])
        p = true;
      else
        p = false;
    } else {
      if (s[l] == s[r])
        p = dfs2(l + 1, r - 1);
      else
        p = false;
    }
  }
  visit[l][r] = true;
  return p;
}
long long dfs(int l, int r) {
  long long &p = dp[l][r];
  if (p == -1) {
    if (l == r) {
      p = 1;
    } else if (r - l == 1) {
      if (dfs2(l, r))
        p = 3;
      else
        p = 2;
    } else {
      p = dfs(l + 1, r) + dfs(l, r - 1) - dfs(l + 1, r - 1);
      if (dfs2(l, r)) p += 1;
    }
  }
  return p;
}
void proses() {
  ans = 0;
  for (int i = 0; i < n - 1; i++) {
    ans += dfs(0, i) * dfs(i + 1, n - 1);
    if (i > 0) ans -= dfs(0, i - 1) * dfs(i + 1, n - 1);
  }
}
void tulis() { cout << ans << endl; }
int main() {
  baca();
  proses();
  tulis();
}