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;
int n;
char c[1000100], S[1000100];
struct node {
  int tr[26];
  int len, fail;
} s[1000100];
int ptr, last;
int newnode(int l) {
  s[ptr].len = l;
  return ptr++;
}
void init() {
  ptr = last = 0;
  newnode(0);
  newnode(-1);
  s[0].fail = 1;
  return;
}
int getfail(int i, int p) {
  while (c[i - s[p].len - 1] != c[i]) p = s[p].fail;
  return p;
}
int diff[1000100], anc[1000100];
void extend(int i, int k) {
  int p = getfail(i, last);
  if (s[p].tr[k] == 0) {
    int np = newnode(s[p].len + 2);
    s[np].fail = s[getfail(i, s[p].fail)].tr[k];
    s[p].tr[k] = np;
    diff[np] = s[np].len - s[s[np].fail].len;
    anc[np] = (diff[np] == diff[s[np].fail] ? anc[s[np].fail] : s[np].fail);
  }
  last = s[p].tr[k];
  return;
}
int f[1000100], ans[1000100];
int main() {
  scanf("%s", S + 1);
  n = strlen(S + 1);
  if (n & 1) {
    puts("0");
    return 0;
  }
  init();
  int cur = 0;
  for (int i = 1, j = n; i < j; ++i, --j) {
    c[++cur] = S[i];
    c[++cur] = S[j];
  }
  ans[0] = 1;
  for (int i = 1; i <= n; ++i) {
    extend(i, c[i] - 'a');
    for (int p = last; p != 0; p = anc[p]) {
      f[p] = ans[i - s[anc[p]].len - diff[p]];
      if (anc[p] != s[p].fail) f[p] = (f[p] + f[s[p].fail]) % 1000000007;
      if (i % 2 == 0) ans[i] = (ans[i] + f[p]) % 1000000007;
    }
  }
  cout << ans[n] << endl;
  return 0;
}