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 mod = 1000000007;
int n, fa[1200000], sf[1200000], len[1200000], f[1200000], g[1200000],
    diff[1200000], c[1200000][30], p, np, cnt;
char s[1200000], a[1200000];
void upd(int &x, int y) { x = (x + y) % mod; }
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n / 2; ++i) {
    a[i * 2 - 1] = s[i];
    a[i * 2] = s[n - i + 1];
  }
  fa[0] = 1;
  len[0] = 0;
  fa[1] = 1;
  len[1] = -1;
  np = cnt = 1;
  f[0] = 1;
  for (int i = 1; i <= n; ++i) {
    int w = a[i] - 'a';
    for (p = np; a[i] != a[i - len[p] - 1]; p = fa[p])
      ;
    if (!c[p][w]) {
      int q = fa[p], now = ++cnt;
      len[now] = len[p] + 2;
      for (; a[i] != a[i - len[q] - 1]; q = fa[q])
        ;
      fa[now] = c[q][w];
      diff[now] = len[now] - len[fa[now]];
      c[p][w] = np = now;
      sf[now] = diff[now] == diff[fa[now]] ? sf[fa[now]] : fa[now];
    } else
      np = c[p][w];
    for (int q = np; q; q = sf[q]) {
      g[q] = f[i - len[sf[q]] - diff[q]];
      if (diff[q] == diff[fa[q]]) upd(g[q], g[fa[q]]);
      upd(f[i], g[q]);
    }
    if (i & 1) f[i] = 0;
  }
  printf("%d\n", f[n]);
  return 0;
}