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 = 1e6 + 10, MAXM = 4e6 + 10;
const int INF = INT_MAX, SINF = 0x3f3f3f3f;
const long long llINF = LLONG_MAX;
const int MOD = 1e9 + 7, mod = 119;
const int Lim = 1 << 20;
struct PAM {
  int sz, tot, last;
  int ch[MAXN][26], len[MAXN], fail[MAXN];
  int cnt[MAXN], dep[MAXN], dif[MAXN], slink[MAXN];
  char s[MAXN];
  int newnode(int l) {
    sz++;
    memset(ch[sz], 0, sizeof(ch[sz]));
    len[sz] = l;
    fail[sz] = cnt[sz] = dep[sz] = 0;
    return sz;
  }
  void init() {
    sz = -1;
    last = 0;
    s[tot = 0] = '$';
    newnode(0);
    newnode(-1);
    fail[0] = 1;
  }
  int getfail(int x) {
    while (s[tot - len[x] - 1] != s[tot]) x = fail[x];
    return x;
  }
  void insert(char c) {
    s[++tot] = c;
    int now = getfail(last);
    if (!ch[now][c - 'a']) {
      int x = newnode(len[now] + 2);
      fail[x] = ch[getfail(fail[now])][c - 'a'];
      dep[x] = dep[fail[x]] + 1;
      ch[now][c - 'a'] = x;
      dif[x] = len[x] - len[fail[x]];
      if (dif[x] == dif[fail[x]])
        slink[x] = slink[fail[x]];
      else
        slink[x] = fail[x];
    }
    last = ch[now][c - 'a'];
    cnt[last]++;
  }
} pam;
int n, dp[MAXN], g[MAXN];
char s[MAXN], t[MAXN];
int main() {
  pam.init();
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1, j = 0; i <= n; i++) t[++j] = s[i], t[++j] = s[n - i + 1];
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    pam.insert(t[i]);
    for (int x = pam.last; x > 1; x = pam.slink[x]) {
      g[x] = dp[i - pam.len[pam.slink[x]] - pam.dif[x]];
      if (pam.dif[x] == pam.dif[pam.fail[x]])
        g[x] = (g[x] + g[pam.fail[x]]) % MOD;
      if (i % 2 == 0) dp[i] = (dp[i] + g[x]) % MOD;
    }
  }
  printf("%d", dp[n]);
  return 0;
}