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 MAXN = 1000000;
const int MOD = int(1E9) + 7;
struct node {
  int len, dif, f;
  node *slk, *ch[26], *fa;
} pl[MAXN + 5], *rt1, *rt2, *ncnt;
node *nd[MAXN + 5];
void build(char *S, int len) {
  rt1 = ncnt = pl, rt2 = (++ncnt);
  rt2->fa = rt1, rt1->len = -1, rt2->len = 0;
  node *pre = rt1;
  for (int i = 0; i < len; i++) {
    while (S[i] != S[i - pre->len - 1]) pre = pre->fa;
    if (pre->ch[S[i] - 'a'] == NULL) {
      node *q = (++ncnt);
      q->len = pre->len + 2;
      if (pre == rt1)
        q->fa = rt2;
      else {
        node *p = pre->fa;
        while (S[i] != S[i - p->len - 1]) p = p->fa;
        q->fa = p->ch[S[i] - 'a'];
      }
      q->dif = q->len - q->fa->len;
      q->slk = (q->dif == q->fa->dif ? q->fa->slk : q->fa);
      pre->ch[S[i] - 'a'] = q;
    }
    nd[i + 1] = pre = pre->ch[S[i] - 'a'];
  }
}
char s[MAXN + 5], t[MAXN + 5];
int dp[MAXN + 5];
int main() {
  scanf("%s", s);
  int len = strlen(s);
  for (int i = 0; i < len / 2; i++)
    t[(i << 1) + 1] = s[i], t[(i << 1 | 1) + 1] = s[len - i - 1];
  build(t + 1, len);
  dp[0] = 1;
  for (int i = 1; i <= len; i++) {
    node *p = nd[i];
    while (p != rt2) {
      p->f = dp[i - p->slk->len - p->dif];
      if (p->slk != p->fa) p->f = (p->f + p->fa->f) % MOD;
      dp[i] = (dp[i] + p->f) % MOD;
      p = p->slk;
    }
    if (i & 1) dp[i] = 0;
  }
  printf("%d\n", dp[len]);
}