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 JAVA):

Solution:

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 *
 * @author HronoS
 */
public class vk4 implements Runnable {
  
  StringTokenizer st;
  BufferedReader in;
  PrintWriter out;
  
  public static void main(String[] args) {
    new Thread(new vk4()).start();
  }
  
  public void run() {
    try {
      boolean oj = System.getProperty("ONLINE_JUDGE") != null;
      Reader reader = oj ? new InputStreamReader(System.in) : new FileReader("vk4.in");
      Writer writer = oj ? new OutputStreamWriter(System.out) : new FileWriter("vk4.out");
      
      in = new BufferedReader(reader);
      out = new PrintWriter(writer);
      
      solve();
    } catch (Exception e) {
      if (System.getProperty("ONLINE_JUDGE") == null) {
        e.printStackTrace();
      }
      System.exit(9000);
    } finally {
      out.flush();
      out.close();
    }
  }
  
  String nextToken() throws IOException {
    while (st == null || !st.hasMoreTokens()) {
      st = new StringTokenizer(in.readLine());
    }
    return st.nextToken();
  }
  
  int nextInt() throws NumberFormatException, IOException {
    return Integer.parseInt(nextToken());
  }
  
  long nextLong() throws NumberFormatException, IOException {
    return Long.parseLong(nextToken());
  }
  
  double nextDouble() throws NumberFormatException, IOException {
    return Double.parseDouble(nextToken());
  }
  
  void solve() throws NumberFormatException, IOException {
    String str = nextToken();
    int length = str.length();
    
    int[][] pols = new int[2001][2001];
    long[][] kol = new long[2001][2001];
    for (int i = 0; i < length; i++) {
      Arrays.fill(pols[i], -1);
    }
    for (int i = 0; i < length; i++) {
      pols[i][i] = 1;
      pols[i+1][i] = 0;
      kol[i][i] = 1;
    }
    
    for (int i = length - 1; i >= 0; i--) {
      for (int j = i + 1; j < length; j++) {
        if(str.charAt(i) == str.charAt(j)){
          if(pols[i+1][j-1] >= 0){
            pols[i][j] = pols[i+1][j-1] + 2;
          }
        }
      }
    }
       
    for (int i = length - 1; i >= 0; i--) {
      for (int j = i + 1; j < length; j++) {
        kol[i][j] = kol[i][j-1] + kol[i+1][j] - kol[i+1][j-1] + (pols[i][j]>0 ? 1 : 0);
      }
    }

    long ans = 0;
    for (int i = 0; i < length - 1; i++) {
      for (int j = 0; j < length - 1; j++) {
        if(pols[i][j] > 0){
          ans += kol[j+1][length - 1];
        }
      }
    }
    out.print(ans);
  }
}