Problem: Given a string s, find the number of ways to split s to substrings such that if there are k substrings (p1, p2, p3, ..., pk) in partition, then pi = pk - i + 1 for all i (1 ≤ i ≤ k) and k is even.

Since the number of ways can be large, print it modulo 109 + 7.

Input

The only line of input contains a string s (2 ≤ |s| ≤ 106) of even length consisting of lowercase Latin letters. 

Output

Print one integer, the number of ways of partitioning the string modulo 109 + 7.

Examples

Input

abcdcdab


Output

1

Input

abbababababbab


Output

3

Note

In the first case, the only way to partition the string is ab|cd|cd|ab.

In the second case, the string can be partitioned as ab|b|ab|ab|ab|ab|b|ab or ab|b|abab|abab|b|ab or abbab|ab|ab|abbab.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const int mo = 1e9 + 7;
char s[N], g[N];
int n, slink[N], link[N], c[N][26], len[N], tot, last, d[N];
long long f[N], sumf[N][2];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  if (n % 2) {
    printf("0");
    return 0;
  }
  for (int i = 1; i * 2 <= n; i++) g[i * 2 - 1] = s[i];
  for (int i = n, w = 2; i > (n >> 1); i--, w += 2) {
    g[w] = s[i];
  }
  memcpy(s, g, sizeof s);
  f[0] = 1;
  len[1] = -1;
  link[0] = 1;
  tot = 1;
  for (int i = 1; i <= n; i++) {
    while (s[i - 1 - len[last]] != s[i]) {
      last = link[last];
    }
    int r = s[i] - 'a';
    if (c[last][r] == 0) {
      len[++tot] = len[last] + 2;
      int k = link[last];
      while (s[i - 1 - len[k]] != s[i]) k = link[k];
      link[tot] = c[k][r];
      c[last][r] = tot;
      d[tot] = len[tot] - len[link[tot]];
      slink[tot] = d[tot] == d[link[tot]] ? slink[link[tot]] : link[tot];
    }
    last = c[last][r];
    for (int v = last; len[v] > 0; v = slink[v]) {
      sumf[v][0] = sumf[v][1] = 0;
      sumf[v][(i - len[slink[v]] - d[v]) & 1] = f[i - len[slink[v]] - d[v]];
      if (d[v] == d[link[v]]) {
        sumf[v][0] = (sumf[v][0] + sumf[link[v]][0]) % mo;
        sumf[v][1] = (sumf[v][1] + sumf[link[v]][1]) % mo;
      }
      f[i] = (f[i] + sumf[v][i & 1]) % mo;
    }
  }
  cout << f[n] << endl;
}