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;
char T[1000010], s[1000010];
int n, tot, fin, ch[1000010][26], fail[1000010], len[1000010], dif[1000010],
    top[1000010], f[1000010], g[1000010];
int getf(int u, int i) {
  while (s[i] ^ s[i - len[u] - 1]) u = fail[u];
  return u;
}
int main() {
  scanf("%s", T + 1), n = strlen(T + 1);
  if (n & 1) puts("0"), exit(0);
  for (int i = 1; i <= n / 2; i++) s[i * 2 - 1] = T[i], s[i * 2] = T[n - i + 1];
  len[0] = 0, len[1] = -1, fail[0] = 1, fail[1] = 0, tot = 1;
  f[0] = 1;
  for (int i = 1; i <= n; i++) {
    int c = s[i] - 97, p = getf(fin, i);
    if (!ch[p][c]) {
      len[++tot] = len[p] + 2;
      fail[tot] = ch[getf(fail[p], i)][c];
      int F = fail[tot];
      dif[tot] = len[tot] - len[F];
      top[tot] = dif[tot] == dif[F] ? top[F] : F;
      ch[p][c] = tot;
    }
    fin = ch[p][c];
    int t = fin;
    while (t) {
      g[t] = f[i - len[top[t]] - dif[t]];
      if (top[t] ^ fail[t]) (g[t] += g[fail[t]]) %= 1000000007;
      if (i % 2 == 0) (f[i] += g[t]) %= 1000000007;
      t = top[t];
    }
  }
  printf("%d\n", f[n]);
  return 0;
}