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 maxn(1e6 + 5);
const int mod(1e9 + 7);
inline void Inc(int &x, int y) {
  if ((x += y) >= mod) x -= mod;
}
int n, f[maxn], dif[maxn], anc[maxn], g[maxn];
int fa[maxn], len[maxn], trans[26][maxn], tot, last;
char s[maxn], tmp[maxn];
inline void Extend(int c, int pos) {
  register int np, p = last, q, i;
  while (s[pos] != s[pos - len[p] - 1]) p = fa[p];
  if (!trans[c][p]) {
    np = ++tot, len[np] = len[p] + 2, q = fa[p];
    while (s[pos] != s[pos - len[q] - 1]) q = fa[q];
    fa[np] = trans[c][q], trans[c][p] = np;
    dif[np] = len[np] - len[fa[np]];
    anc[np] = dif[np] == dif[fa[np]] ? anc[fa[np]] : np;
  }
  last = trans[c][p];
}
int main() {
  register int i, j, l = 0;
  scanf(" %s", tmp + 1), n = strlen(tmp + 1);
  if (n & 1) return puts("0"), 0;
  for (i = 1, j = n; i <= j; ++i, --j) s[++l] = tmp[i], s[++l] = tmp[j];
  f[0] = 1, len[1] = -1, fa[1] = fa[0] = 1, tot = last = 1;
  for (i = 1; i <= n; ++i) {
    Extend(s[i] - 'a', i);
    for (j = last; j; j = fa[anc[j]]) {
      g[j] = f[i - len[anc[j]]];
      if (anc[j] != j) Inc(g[j], g[fa[j]]);
      if (~i & 1) Inc(f[i], g[j]);
    }
  }
  printf("%d\n", f[n]);
  return 0;
}