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 = 1000010;
const int ALP = 26;
struct PAM {
  int next[maxn][ALP];
  int fail[maxn];
  int len[maxn];
  int s[maxn];
  int last;
  int n;
  int p;
  int diff[maxn], anc[maxn];
  int newnode(int l) {
    for (int i = 0; i < ALP; i++) next[p][i] = 0;
    len[p] = l;
    return p++;
  }
  void init() {
    p = 0;
    newnode(0);
    newnode(-1);
    last = 0;
    n = 0;
    s[n] = -1;
    fail[0] = 1;
  }
  int get_fail(int x) {
    while (s[n - len[x] - 1] != s[n]) x = fail[x];
    return x;
  }
  void add(int c) {
    c = c - 'a';
    s[++n] = c;
    int cur = get_fail(last);
    if (!next[cur][c]) {
      int now = newnode(len[cur] + 2);
      fail[now] = next[get_fail(fail[cur])][c];
      next[cur][c] = now;
      diff[now] = len[now] - len[fail[now]];
      if (diff[now] == diff[fail[now]])
        anc[now] = anc[fail[now]];
      else
        anc[now] = fail[now];
    }
    last = next[cur][c];
  }
} pam;
char s[maxn], t[maxn];
long long f[maxn], g[maxn];
const long long mo = 1000000007;
int main() {
  scanf("%s", s + 1);
  int len = strlen(s + 1);
  pam.init();
  int k = 0;
  for (int i = 1; i <= len / 2; i++) t[++k] = s[i], t[++k] = s[len - i + 1];
  memset(f, 0, sizeof(f));
  f[0] = 1;
  for (int i = 1; i <= k; i++) {
    pam.add(t[i]);
    int x = pam.last;
    while (x > 0) {
      g[x] = f[i - pam.len[pam.anc[x]] - pam.diff[x]];
      if (pam.diff[x] == pam.diff[pam.fail[x]])
        g[x] += g[pam.fail[x]], g[x] %= mo;
      if (i % 2 == 0) {
        f[i] += g[x];
        f[i] %= mo;
      }
      x = pam.anc[x];
    }
  }
  printf("%lld\n", f[k]);
  return 0;
}