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 + 100;
const int mod = 1e9 + 7;
char s[N], t[N], cnt;
int n;
long long f[N], g[N];
struct Palindrome_tree {
  int nxt[N][26];
  int fail[N];
  int len[N];
  int cnt[N];
  int sed[N];
  int record[N];
  int diff[N], anc[N];
  char s[N];
  int tot;
  int last;
  int n;
  void newnode() {
    tot++;
    memset(nxt[tot], 0, sizeof(nxt[tot]));
    cnt[tot] = sed[tot] = len[tot] = fail[tot] = 0;
  }
  void init() {
    n = 0;
    tot = -1;
    newnode();
    newnode();
    len[0] = 0, len[1] = -1;
    tot = 1, last = 0;
    fail[0] = 1;
  }
  int getfail(int x, int n) {
    while (s[n - len[x] - 1] != s[n] || n - len[x] - 1 < 0) x = fail[x];
    return x;
  }
  void insert(char ch) {
    int c = ch - 'a';
    s[++n] = ch;
    int p = getfail(last, n);
    if (!nxt[p][c]) {
      newnode();
      len[tot] = len[p] + 2;
      fail[tot] = nxt[getfail(fail[p], n)][c];
      sed[tot] = sed[fail[tot]] + 1;
      nxt[p][c] = tot;
      diff[tot] = len[tot] - len[fail[tot]];
      anc[tot] = diff[tot] == diff[fail[tot]] ? anc[fail[tot]] : fail[tot];
    }
    last = nxt[p][c];
    cnt[last]++;
    record[last] = n;
    trans(n);
  }
  void trans(int i) {
    for (int j = last; j > 1; j = anc[j]) {
      g[j] = f[i - len[anc[j]] - diff[j]];
      if (diff[j] == diff[fail[j]]) g[j] = (g[j] + g[fail[j]]) % mod;
      f[i] = (f[i] + (i % 2 == 0) * g[j]) % mod;
    }
  }
  void get_cnt() {
    for (int i = tot; i > 0; i--) cnt[fail[i]] += cnt[i];
  }
} tree;
int main() {
  tree.init();
  scanf("%s", s + 1);
  n = strlen(s + 1);
  int l = 1, r = n;
  for (int i = 1; i <= n / 2; i++) {
    t[2 * i - 1] = s[i];
    t[2 * i] = s[n + 1 - i];
  }
  f[0] = 1;
  for (int i = 1; i <= n; i++) tree.insert(t[i]);
  printf("%lld\n", f[n]);
  return 0;
}