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 long long mod = 1e9 + 7;
const int maxn = 1e6;
long long ans;
long long pw[maxn + 5];
char s[maxn + 5], t[maxn + 5];
struct Palindromic_Tree {
  int ch[maxn + 5][26];
  int s[maxn + 5];
  int fail[maxn + 5];
  int cnt[maxn + 5];
  int num[maxn + 5];
  int len[maxn + 5];
  int diff[maxn + 5];
  int anc[maxn + 5];
  int last;
  int n;
  int p;
  int newnode(int l) {
    for (int i = 0; i < 26; ++i) ch[p][i] = 0;
    cnt[p] = 0;
    num[p] = 0;
    diff[p] = anc[p] = 0;
    len[p] = l;
    return p++;
  }
  void init() {
    for (int i = 0; i <= p; ++i)
      fail[i] = cnt[i] = num[i] = len[i] = diff[i] = anc[i] = 0;
    for (int i = 0; i <= p; ++i)
      for (int j = 0; j < 26; ++j) ch[i][j] = 0;
    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 -= 'a';
    s[++n] = c;
    int cur = get_fail(last);
    if (!ch[cur][c]) {
      int now = newnode(len[cur] + 2);
      fail[now] = ch[get_fail(fail[cur])][c];
      ch[cur][c] = now;
      num[now] = num[fail[now]] + 1;
      diff[now] = len[now] - len[fail[now]];
      anc[now] = diff[now] == diff[fail[now]] ? anc[fail[now]] : fail[now];
    }
    last = ch[cur][c];
    cnt[last]++;
  }
  void count() {
    for (int i = p - 1; i >= 0; --i) cnt[fail[i]] += cnt[i];
  }
} PT;
int f[maxn + 5], dp[maxn + 5];
int main() {
  scanf("%s", t + 1);
  int len = strlen(t + 1);
  if (len & 1) return 0 * printf("0");
  for (int i = 1; i <= len / 2; ++i) s[2 * i - 1] = t[i];
  for (int i = len; i > len / 2; --i) s[(len - i + 1) * 2] = t[i];
  PT.init();
  dp[0] = 1;
  for (int i = 1; i <= len; ++i) {
    PT.add(s[i]);
    for (int p = PT.last; p > 1; p = PT.anc[p]) {
      f[p] = dp[i - PT.len[PT.anc[p]] - PT.diff[p]];
      if (PT.diff[p] == PT.diff[PT.fail[p]])
        f[p] = (f[p] + f[PT.fail[p]]) % mod;
      if (i % 2 == 0) dp[i] = (dp[i] + f[p]) % mod;
    }
  }
  cout << dp[len] << endl;
  return 0;
}