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, s[1000005], top[1000005], f[1000005], g[1000005];
int c[1000005][26], F[1000005], len[1000005], cnt, pos[1000005];
char str[1000005];
int main() {
  scanf("%s", str + 1);
  n = strlen(str + 1);
  s[0] = -1;
  for (int i = 1; i <= n / 2; i++) {
    s[i * 2 - 1] = str[i] - 'a';
    s[i * 2] = str[n - i + 1] - 'a';
  }
  len[0] = -1;
  cnt = 1;
  for (int i = 1, now = 1; i <= n; i++) {
    while (s[i - len[now] - 1] != s[i]) now = F[now];
    if (!c[now][s[i]]) {
      cnt++;
      len[cnt] = len[now] + 2;
      int tmp = F[now];
      while (s[i - len[tmp] - 1] != s[i]) tmp = F[tmp];
      F[cnt] = c[tmp][s[i]] ? c[tmp][s[i]] : 1;
      c[now][s[i]] = cnt;
    }
    pos[i] = now = c[now][s[i]];
  }
  top[1] = 1;
  for (int i = 2; i <= cnt; i++)
    if (F[i] != 1 && len[i] + len[F[F[i]]] == len[F[i]] * 2)
      top[i] = top[F[i]];
    else
      top[i] = i;
  f[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = pos[i]; j != 1; j = F[top[j]]) {
      if (top[j] != j)
        g[j] = (g[F[j]] + f[i - len[top[j]]]) % 1000000007;
      else
        g[j] = f[i - len[j]];
      f[i] = (f[i] + g[j]) % 1000000007;
    }
    if (i & 1) f[i] = 0;
  }
  printf("%d\n", f[n]);
}