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>
const int N = 1e6 + 5, md = 1e9 + 7;
char t[N], s[N];
int n, k, ch[N][26], len[N], lst, fail[N], tot, fa[N], dlt[N];
int ans[N], f[N];
inline void upd(int& a) { a += a >> 31 & md; }
void ins(int pos) {
  int p = lst, c = s[pos] - 'a';
  while (s[pos] != s[pos - len[p] - 1]) p = fail[p];
  if (!ch[p][c]) {
    int np = ++tot;
    len[np] = len[p] + 2;
    int q = fail[p];
    for (; s[pos] != s[pos - len[q] - 1]; q = fail[q])
      ;
    int x = fail[np] = ch[q][c];
    dlt[np] = len[np] - len[x];
    fa[np] = dlt[np] == dlt[x] ? fa[x] : x;
    ch[p][c] = np;
  }
  lst = ch[p][c];
}
int main() {
  scanf("%s", t + 1);
  n = strlen(t + 1);
  if (n & 1) return puts("0"), 0;
  for (int l = 1, r = n; l <= r; ++l, --r) s[++k] = t[l], s[++k] = t[r];
  lst = tot = 1, len[1] = -1, len[0] = 0, fail[0] = ans[0] = 1;
  for (int i = 1; i <= n; ++i) {
    ins(i);
    for (int j = lst; j; j = fa[j]) {
      f[j] = ans[i - len[fa[j]] - dlt[j]];
      if (dlt[j] == dlt[fail[j]]) upd(f[j] += f[fail[j]] - md);
      upd(ans[i] += f[j] - md);
    }
    if (i & 1) ans[i] = 0;
  }
  printf("%d\n", ans[n]);
  return 0;
}