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;
long long n;
long long ncr(long long n, long long r) {
  long long i, ans = 1, k = 0;
  if (r == 0)
    return 1;
  else if (n < r)
    return 0;
  for (i = n; i >= n - r + 1; i--) {
    ans *= i;
    ans /= n - i + 1;
  }
  return ans;
}
void max_heapify(int a[100], int i) {
  int l, r, largest = i;
  l = 2 * i + 1;
  r = 2 * i + 2;
  if (l < n && a[l] > a[i]) largest = l;
  if (r < n && a[r] > a[l]) largest = r;
  if (largest != i) {
    int k;
    k = a[i];
    a[i] = a[largest];
    a[largest] = k;
    max_heapify(a, largest);
  }
}
int power(long long x, long long y, long long p) {
  int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
bool square(long long n) {
  double x;
  x = sqrt(n);
  if (x == floor(x))
    return true;
  else
    return false;
}
bool prime(long long n) {
  long long i;
  for (i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
long long modi(long long a, long long m) { return power(a, m - 2, m); }
void kmp(string s, long long p[]) {
  int n = (int)s.length();
  p[0] = 0;
  for (int i = 1; i < n; i++) {
    int j = p[i - 1];
    while (j > 0 && s[i] != s[j]) j = p[j - 1];
    if (s[i] == s[j]) j++;
    p[i] = j;
  }
}
void zfunc(string s, long long z[]) {
  long long n = (long long)s.length();
  z[0] = 0;
  for (long long i = 1, l = 0, r = 0; i < n; ++i) {
    if (i <= r) z[i] = min(r - i + 1, z[i - l]);
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
}
struct pair_hash {
  size_t operator()(const pair<int, int>& p) const noexcept {
    return hash<long long>()((((long long)p.first) << 32) |
                             ((long long)p.second));
  }
};
bool palin(string s) {
  long long i, n;
  n = s.length();
  for (i = 0; i <= n / 2; i++) {
    if (s[i] != s[n - i - 1]) {
      return false;
    }
  }
  return true;
}
long long sum(long long n) {
  long long i;
  i = n;
  long long sum = 0;
  while (i > 0) {
    sum += i % 10;
    i = i / 10;
  }
  return sum;
}
long long nCr(long long n, long long r, long long p, long long fac[]) {
  if (r == 0) return 1;
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % p;
  return (fac[n] * modi(fac[r], p) % p * modi(fac[n - r], p) % p) % p;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long mod(string num, long long a) {
  long long res = 0;
  for (long long i = 0; i < num.length(); i++)
    res = (res * 10 + (long long)num[i] - '0') % a;
  return res;
}
long long parent[1000], sizer[1000];
long long findset(long long a) {
  if (a == parent[a]) {
    return a;
  }
  parent[a] = findset(parent[a]);
  return parent[a];
}
void unionset(long long a, long long b) {
  a = findset(a);
  b = findset(b);
  if (sizer[a] < sizer[b]) {
    swap(a, b);
  }
  sizer[b] += sizer[a];
  parent[b] = a;
}
struct fenwick {
  vector<long long> bit;
  long long n;
  fenwick(long long n, vector<long long> v) {
    this->n = n;
    bit.assign(n, 0);
    for (long long it = 0; it < n; it++) {
      add(it, v[it]);
    }
  }
  long long sum(long long idx) {
    if (idx < 0) return 0;
    long long ret = 0;
    for (; idx >= 0; idx = (idx & (idx + 1)) - 1) {
      ret += bit[idx];
    }
    return ret;
  }
  void add(long long idx, long long x) {
    for (; idx < n; idx = idx | (idx + 1)) {
      bit[idx] += x;
      bit[idx] = max(0LL, bit[idx]);
    }
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long T = 1, i, j;
  while (T--) {
    string s;
    cin >> s;
    long long n = s.length();
    vector<vector<bool>> good(n, vector<bool>(n));
    vector<vector<long long>> dp(n, vector<long long>(n));
    for (i = 0; i < n; i++) {
      long long j1 = i, j2 = i;
      long long kk = 1;
      long long len = 1;
      good[i][i] = true;
      while ((j1 - 1 >= 0 && j2 + 1 < n) && (s[j1 - 1] == s[j2 + 1])) {
        good[j1 - 1][j2 + 1] = true;
        j1--;
        j2++;
        if (j1 < 1 || j2 >= n - 1) {
          break;
        }
      }
    }
    for (i = 0; i < n; i++) {
      long long j1 = i, j2 = i + 1;
      long long kk = 1;
      if (s[j1] == s[j2]) {
        long long len = 0;
        while ((j1 >= 0 && j2 < n) && (s[j1] == s[j2])) {
          good[j1][j2] = true;
          j2++;
          j1--;
          if (j1 < 0 || j2 >= n) {
            break;
          }
        }
      }
    }
    vector<long long> count(n);
    for (i = 0; i < n; i++) {
      for (j = i; j >= 0; j--) {
        if (good[j][i]) {
          count[i]++;
        }
      }
    }
    vector<long long> count2(n + 1);
    for (i = n - 1; i >= 0; i--) {
      for (j = i; j < n; j++) {
        if (good[i][j]) {
          count2[i]++;
        }
      }
    }
    vector<long long> pref(n + 2), pref2(n + 2);
    for (i = 0; i < n; i++) {
      pref[i + 1] = pref[i] + count[i];
    }
    for (i = n - 1; i >= 0; i--) {
      pref2[i] = pref2[i + 1] + count2[i];
    }
    long long ans = 0;
    for (i = 0; i < n; i++) {
      ans += pref[i + 1] * count2[i + 1];
    }
    cout << ans;
  }
  return 0;
}