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;
template <typename T>
inline bool cmax(T& x, T y) {
  return y > x ? x = y, true : false;
}
template <typename T>
inline bool cmin(T& x, T y) {
  return y < x ? x = y, true : false;
}
const int MAXN = 1e6 + 5;
const int oo = 0x3f3f3f3f;
const int mod = 1e9 + 7;
inline int add(int a, int b) {
  a += b;
  return a >= mod ? a - mod : a;
}
inline int pop(int a, int b) {
  a -= b;
  return a < 0 ? a + mod : a;
}
inline int mul(int a, int b) { return 1LL * a * b % mod; }
int N;
int cnt = 1, now, son[MAXN][26], pre[MAXN], spre[MAXN], len[MAXN], diff[MAXN];
char s[MAXN], ss[MAXN];
int f[MAXN], g[MAXN];
void extend(int o, int nxt) {
  while (s[o - len[now] - 1] != s[o]) now = pre[now];
  if (!son[now][nxt]) {
    int np = ++cnt;
    len[np] = len[now] + 2;
    int anc = pre[now];
    while (s[o - len[anc] - 1] != s[o]) anc = pre[anc];
    pre[np] = son[anc][nxt];
    son[now][nxt] = np;
    diff[np] = len[np] - len[pre[np]];
    spre[np] = diff[np] == diff[pre[np]] ? spre[pre[np]] : pre[np];
  }
  now = son[now][nxt];
}
int main() {
  scanf("%s", ss + 1);
  N = strlen(ss + 1);
  for (int i = 1; i <= N / 2; i++) s[(i << 1) - 1] = ss[i];
  for (int i = 1; i <= N / 2; i++) s[i << 1] = ss[N - i + 1];
  pre[0] = pre[1] = 1;
  len[1] = -1;
  f[0] = 1;
  for (int i = 1; i <= N; i++) {
    extend(i, s[i] - 'a');
    for (int v = now; len[v] > 0; v = spre[v]) {
      g[v] = diff[v] == diff[pre[v]] ? g[pre[v]] : 0;
      int o = i - len[spre[v]] - diff[v];
      g[v] = add(g[v], f[o]);
      f[i] = add(f[i], g[v]);
    }
    if ((i & 1)) f[i] = 0;
  }
  printf("%d\n", f[N]);
  return 0;
}