#include <bits/stdc++.h>
using namespace std;
map<long long, bool> tz;
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int cnk(long long n, long long k, long long mod) {
  long long result = 1;
  int lal = 0;
  for (int lol = n; lal < k; lal++, lol--) {
    result *= lol;
    result %= mod;
  }
  return result;
}
const long long mod = 1e9 + 7;
vector<long long> graph[100000];
vector<long long> vec;
vector<pair<long long, long long> > vec2;
vector<long long> nap[4];
bool masi[100000];
long long mas1[100];
long long mas2[100];
string s;
long long log4(long long val) {
  long long lol = 1;
  long long ii = 0;
  if (val == 1) {
    return 1;
  }
  while (lol < val) {
    ii++;
    lol *= 4;
  }
  return ii;
}
long long razn(long long lol, long long n) {
  long long raznik = n - (lol + 1) - (lol + 1);
  if (raznik > 0) raznik--;
  if (raznik < 0) raznik++;
  return raznik;
}
long long power(long long a, long long b) {
  long long res = 1;
  for (long long i = 0; i < b; i++) {
    res *= a;
  }
  return res;
}
bool comp(long long a, long long b) { return a > b; }
string tostr(long long a) {
  ostringstream out;
  out << a;
  return out.str();
}
map<string, long long> ochki;
pair<long long, pair<int, int> > msp(long long a, int b, int c) {
  return make_pair(a, make_pair(b, c));
}
pair<long long, pair<int, int> > maxp(pair<long long, pair<int, int> > pair1,
                                      pair<long long, pair<int, int> > pair2) {
  if (pair1.first > pair2.first)
    return pair1;
  else {
    if (pair1.first < pair2.first)
      return pair2;
    else {
      if (pair1.second.second < pair2.second.second)
        return pair1;
      else
        return pair2;
    }
  }
}
long long tobig(string str) {
  long long res = 0;
  for (long long lol = 0; lol < str.size(); lol++) {
    res += (str[lol] - 48) * power(10, str.size() - 1 - lol);
  }
  return res;
}
long long mas[200005];
long long res[5004][5004];
vector<long long> konci[10000];
long long kolvo[10000];
int main() {
  int n, a, b, c, k;
  cin >> s;
  long long dp[s.length() + 1];
  s = " " + s;
  kolvo[0] = 0;
  dp[0] = 0;
  for (double lol = 1; lol <= s.length() - 1; lol += 0.5) {
    if (lol == (long long)lol) {
      double k = 0;
      while (true) {
        if (lol - k > 0 && lol + k <= s.length() - 1) {
          if (s[(long long)(lol + k)] == s[(long long)(lol - k)]) {
            konci[(long long)(lol + k)].push_back(2 * k + 1);
            kolvo[(long long)(lol + k)]++;
          } else
            break;
        } else
          break;
        k++;
      }
    } else {
      double k = 0.5;
      while (true) {
        if (lol - k > 0 && lol + k <= s.length() - 1) {
          if (s[(long long)(lol + k)] == s[(long long)(lol - k)]) {
            konci[(long long)(lol + k)].push_back(2 * k + 1);
            kolvo[(long long)(lol + k)]++;
          } else
            break;
        } else
          break;
        k++;
      }
    }
  }
  long long sumres = 0;
  for (long long lal = 1; lal < 10000; lal++) {
    kolvo[lal] += kolvo[lal - 1];
  }
  for (long long i = 1; i < s.length(); i++) {
    for (long long lal = 0; lal < konci[i].size(); lal++) {
      sumres += kolvo[i - konci[i][lal]];
    }
  }
  cout << sumres;
  return 0;
}

### Prompt

In CPP, your task is to solve the following 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

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
map<long long, bool> tz;
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int cnk(long long n, long long k, long long mod) {
  long long result = 1;
  int lal = 0;
  for (int lol = n; lal < k; lal++, lol--) {
    result *= lol;
    result %= mod;
  }
  return result;
}
const long long mod = 1e9 + 7;
vector<long long> graph[100000];
vector<long long> vec;
vector<pair<long long, long long> > vec2;
vector<long long> nap[4];
bool masi[100000];
long long mas1[100];
long long mas2[100];
string s;
long long log4(long long val) {
  long long lol = 1;
  long long ii = 0;
  if (val == 1) {
    return 1;
  }
  while (lol < val) {
    ii++;
    lol *= 4;
  }
  return ii;
}
long long razn(long long lol, long long n) {
  long long raznik = n - (lol + 1) - (lol + 1);
  if (raznik > 0) raznik--;
  if (raznik < 0) raznik++;
  return raznik;
}
long long power(long long a, long long b) {
  long long res = 1;
  for (long long i = 0; i < b; i++) {
    res *= a;
  }
  return res;
}
bool comp(long long a, long long b) { return a > b; }
string tostr(long long a) {
  ostringstream out;
  out << a;
  return out.str();
}
map<string, long long> ochki;
pair<long long, pair<int, int> > msp(long long a, int b, int c) {
  return make_pair(a, make_pair(b, c));
}
pair<long long, pair<int, int> > maxp(pair<long long, pair<int, int> > pair1,
                                      pair<long long, pair<int, int> > pair2) {
  if (pair1.first > pair2.first)
    return pair1;
  else {
    if (pair1.first < pair2.first)
      return pair2;
    else {
      if (pair1.second.second < pair2.second.second)
        return pair1;
      else
        return pair2;
    }
  }
}
long long tobig(string str) {
  long long res = 0;
  for (long long lol = 0; lol < str.size(); lol++) {
    res += (str[lol] - 48) * power(10, str.size() - 1 - lol);
  }
  return res;
}
long long mas[200005];
long long res[5004][5004];
vector<long long> konci[10000];
long long kolvo[10000];
int main() {
  int n, a, b, c, k;
  cin >> s;
  long long dp[s.length() + 1];
  s = " " + s;
  kolvo[0] = 0;
  dp[0] = 0;
  for (double lol = 1; lol <= s.length() - 1; lol += 0.5) {
    if (lol == (long long)lol) {
      double k = 0;
      while (true) {
        if (lol - k > 0 && lol + k <= s.length() - 1) {
          if (s[(long long)(lol + k)] == s[(long long)(lol - k)]) {
            konci[(long long)(lol + k)].push_back(2 * k + 1);
            kolvo[(long long)(lol + k)]++;
          } else
            break;
        } else
          break;
        k++;
      }
    } else {
      double k = 0.5;
      while (true) {
        if (lol - k > 0 && lol + k <= s.length() - 1) {
          if (s[(long long)(lol + k)] == s[(long long)(lol - k)]) {
            konci[(long long)(lol + k)].push_back(2 * k + 1);
            kolvo[(long long)(lol + k)]++;
          } else
            break;
        } else
          break;
        k++;
      }
    }
  }
  long long sumres = 0;
  for (long long lal = 1; lal < 10000; lal++) {
    kolvo[lal] += kolvo[lal - 1];
  }
  for (long long i = 1; i < s.length(); i++) {
    for (long long lal = 0; lal < konci[i].size(); lal++) {
      sumres += kolvo[i - konci[i][lal]];
    }
  }
  cout << sumres;
  return 0;
}

```