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 inf = 0x3f3f3f3f;
const int N = 1e6 + 7;
const int M = N << 1;
long long mod = 1e9 + 7;
struct pam {
  int t[N][26], fa[N], len[N], rs[N], cnt[N], num[N];
  int dif[N], slink[N];
  int sz, n, last;
  int _new(int l) {
    len[sz] = l;
    cnt[sz] = num[sz] = 0;
    return sz++;
  }
  void init() {
    memset(t, 0, sz * sizeof(t[0]));
    rs[n = sz = 0] = -1;
    last = _new(0);
    fa[last] = _new(-1);
  }
  int get_fa(int x) {
    while (rs[n - 1 - len[x]] != rs[n]) x = fa[x];
    return x;
  }
  void ins(int ch) {
    rs[++n] = ch;
    int p = get_fa(last);
    if (!t[p][ch]) {
      int np = _new(len[p] + 2);
      num[np] = num[fa[np] = t[get_fa(fa[p])][ch]] + 1;
      t[p][ch] = np;
      dif[np] = len[np] - len[fa[np]];
      if (dif[np] == dif[fa[np]])
        slink[np] = slink[fa[np]];
      else
        slink[np] = fa[np];
    }
    ++cnt[last = t[p][ch]];
  }
} pa;
long long dp[N], g[N];
char s[N], t[N * 2];
int main() {
  pa.init();
  scanf("%s", s + 1);
  int len = strlen(s + 1);
  for (int i = 1, j = 0; i <= len; i++) t[++j] = s[i], t[++j] = s[len - i + 1];
  dp[0] = 1;
  for (int i = 1; i <= len; i++) {
    pa.ins(t[i] - 'a');
    for (int x = pa.last; x > 1; x = pa.slink[x]) {
      g[x] = dp[i - pa.len[pa.slink[x]] - pa.dif[x]];
      if (pa.dif[x] == pa.dif[pa.fa[x]]) g[x] = (g[x] + g[pa.fa[x]]) % mod;
      if (i % 2 == 0) dp[i] = (dp[i] + g[x]) % mod;
    }
  }
  printf("%d\n", dp[len]);
}