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 = 1000003, mod = 1e9 + 7;
char str[N], tmp[N];
int n, ch[N][26], fa[N], len[N], f[N], g[N], dif[N], anc[N], lst, cnt;
void qmo(int &x) { x += x >> 31 & mod; }
void insert(int c, int pos) {
  int p = lst;
  while (str[pos] != str[pos - len[p] - 1]) p = fa[p];
  if (!ch[p][c]) {
    int np = ++cnt, q = fa[p];
    len[np] = len[p] + 2;
    while (str[pos] != str[pos - len[q] - 1]) q = fa[q];
    fa[np] = ch[q][c];
    ch[p][c] = np;
    dif[np] = len[np] - len[fa[np]];
    anc[np] = dif[np] == dif[fa[np]] ? anc[fa[np]] : fa[np];
  }
  lst = ch[p][c];
}
int main() {
  scanf("%s", tmp + 1);
  n = strlen(tmp + 1);
  if (n & 1) return puts("0"), 0;
  for (int i = 1; i <= (n >> 1); ++i) {
    str[i * 2 - 1] = tmp[i];
    str[i * 2] = tmp[n + 1 - i];
  }
  f[0] = 1;
  len[1] = -1;
  fa[0] = fa[1] = lst = cnt = 1;
  for (int i = 1; i <= n; ++i) {
    insert(str[i] - 'a', i);
    for (int j = lst; j; j = anc[j]) {
      g[j] = f[i - len[anc[j]] - dif[j]];
      if (anc[j] != fa[j]) qmo(g[j] += g[fa[j]] - mod);
      if (!(i & 1)) qmo(f[i] += g[j] - mod);
    }
  }
  printf("%d\n", f[n]);
}