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 = 1000054, mod = 1000000007;
int n;
int f[N], F[N];
char s[N], t[N], *ptr;
inline void add(int &x, const int y) { x += y - mod, x += x >> 31 & mod; }
namespace PAM {
int p, cnt;
int d[N][26], fail[N], val[N];
int per[N], fst[N];
void init() { val[1] = -1, p = 0, *fail = cnt = 1; }
int get_fail(int x) {
  for (; ptr[~val[x]] != *ptr; x = fail[x])
    ;
  return x;
}
int extend(int x) {
  int &q = d[p = get_fail(p)][x];
  if (!q)
    fail[++cnt] = d[get_fail(fail[p])][x], val[q = cnt] = val[p] + 2,
    per[cnt] = val[cnt] - val[fail[cnt]],
    fst[cnt] = (per[cnt] == per[fail[cnt]] ? fst[fail[cnt]] : fail[cnt]);
  return p = q;
}
}  // namespace PAM
int main() {
  int i, j, p = 0, l;
  scanf("%s", t), n = strlen(t);
  if (n & 1) return putchar(48), putchar(10), 0;
  for (i = 0, j = n - 1; i < j; s[p++] = t[i++], s[p++] = t[j--])
    ;
  PAM::init();
  for (*f = i = 1, ptr = s; i <= n; ++i, ++ptr)
    for (p = PAM::extend(*ptr - 97); p; p = j) {
      j = PAM::fst[p], l = PAM::val[j] + PAM::per[p], F[p] = f[i - l];
      if (PAM::val[p] != l) add(F[p], F[PAM::fail[p]]);
      if (!(i & 1)) add(f[i], F[p]);
    }
  printf("%d\n", f[n]);
  return 0;
}