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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DPalindromePairs solver = new DPalindromePairs();
        solver.solve(1, in, out);
        out.close();
    }

    static class DPalindromePairs {
        char[] arr;
        Boolean[][] memo;

        public void solve(int testNumber, Scanner sc, PrintWriter pw) {
            arr = sc.next().toCharArray();
            memo = new Boolean[arr.length][arr.length];
            for (int i = arr.length - 1; i >= 0; i--)
                for (int j = 0; j < arr.length; j++)
                    dp(i, j);
            for (int i = 0; i < arr.length; i++)
                for (int j = 0; j < arr.length; j++)
                    if (memo[i][j] == null)
                        memo[i][j] = false;
            int[] count = new int[arr.length];
            for (int i = 0; i < count.length; i++) {
                int temp = 0;
                for (int j = i; j < count.length; j++)
                    if (memo[i][j])
                        temp++;
                count[i] = temp;
            }
            int[] suffix = new int[count.length];
            suffix[count.length - 1] = count[suffix.length - 1];
            for (int i = suffix.length - 2; i >= 0; i--)
                suffix[i] = suffix[i + 1] + count[i];
            long ans = 0;
            for (int i = 0; i < arr.length; i++) {
                for (int j = i; j < arr.length - 1; j++) {
                    if (memo[i][j])
                        ans += suffix[j + 1];
                }
            }
            pw.println(ans);
        }

        private boolean dp(int i, int j) {
            if (i >= j)
                return memo[i][j] = true;
            if (memo[i][j] != null)
                return memo[i][j];
            return memo[i][j] = arr[i] == arr[j] && dp(i + 1, j - 1);
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

    }
}