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;
const int N = 1000004;
const int dx[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, 1, 0, -1, -1, 1, -1, 1};
char dir[] = {'L', 'D', 'R', 'U'};
const long long int mod = (long long int)1e9 + 7;
const long long int inf = 1e18 + 100;
int BIT[1000005], n;
int prime[17], spf[17];
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <typename T>
T min3(T a, T b, T c) {
  return min(a, min(b, c));
}
template <typename T>
T max3(T a, T b, T c) {
  return max(a, max(b, c));
}
bool isVowel(char ch) {
  ch = toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
long long int mInv(long long int a, long long int m) {
  long long int m0 = m;
  long long int y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long int q = a / m;
    long long int t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
long long int power(long long int x, long long int y) {
  long long int res = 1;
  x = x % mod;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return res;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long ExtendedGcd(long long a, long long b, long long *x, long long *y) {
  if (!a) {
    *x = 0;
    *y = 1;
    return b;
  }
  long long nx, ny;
  long long d = ExtendedGcd(b % a, a, &nx, &ny);
  long long k = b / a;
  *y = nx;
  *x = -k * nx + ny;
  return d;
}
void update(int x, int delta) {
  if (!x) {
    BIT[x] += delta;
    return;
  }
  for (; x <= N; x += x & -x) BIT[x] += delta;
}
long long int query(int x) {
  long long int sum = BIT[0];
  for (; x > 0; x -= x & -x) sum += BIT[x];
  return sum;
}
void Sieve() {
  for (int i = 1; i <= N; i++) prime[i] = 1;
  prime[0] = 0;
  prime[1] = 0;
  for (long long int p = 2; p * p <= N; p++) {
    if (prime[p] == 1) {
      for (long long int i = p * p; i <= N; i += p) prime[i] = 0;
    }
  }
  for (int p = 3; p <= N; p++) prime[p] += prime[p - 1];
}
void sieve() {
  spf[1] = 1;
  for (int i = 2; i < N; i++) spf[i] = i;
  for (int i = 4; i < N; i += 2) spf[i] = 2;
  for (long long int i = 3; i * i < N; i++) {
    if (spf[i] == i) {
      for (long long int j = i * i; j < N; j += i)
        if (spf[j] == j) spf[j] = i;
    }
  }
}
struct cmp {
  bool operator()(const pair<int, int> &x, const pair<int, int> &y) const {
    if (x.first != y.first) return x.first < y.first;
    return x.second > y.second;
  }
};
void gInput(int m, vector<int> adj[]) {
  int u, v;
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
}
vector<long long int> fac;
void factorial() {
  int N = (int)1e6;
  fac.resize(N);
  fac[0] = 1;
  for (long long int i = 1; i <= N; i++) {
    fac[i] = ((fac[i - 1] % mod) * i) % mod;
  }
}
long long int nCr(long long int n, long long int r) {
  long long int x = fac[n];
  long long int y = fac[r];
  long long int z = fac[n - r];
  long long int pr = ((y % mod) * (z % mod)) % mod;
  pr = mInv(pr, mod);
  long long int ncr = ((x % mod) * (pr % mod)) % mod;
  return ncr;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    string s;
    cin >> s;
    int n = s.size();
    vector<int> adj[n];
    for (int i = 0; i < n; i++) {
      int l = i, r = i;
      while (l >= 0 and r < n and s[l] == s[r]) {
        adj[l].push_back(r - l + 1);
        l--;
        r++;
      }
      l = i;
      r = i + 1;
      while (l >= 0 and r < n and s[l] == s[r]) {
        adj[l].push_back(r - l + 1);
        l--;
        r++;
      }
    }
    long long int ans = 0;
    int pref[n + 1];
    pref[n] = 0;
    pref[n - 1] = adj[n - 1].size();
    for (int i = n - 2; i >= 0; i--) {
      pref[i] = adj[i].size();
      pref[i] += pref[i + 1];
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < adj[i].size(); j++) {
        int p = adj[i][j];
        ans += pref[i + p];
      }
    }
    cout << ans << "\n";
  }
  return 0;
}