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, lst, cnt, f[1001000], g[1001000], h[1001000];
int anc[1001000], fail[1001000];
int diff[1001000], len[1001000];
int nxt[1001000][26];
char s[1001000], A[1001000];
void upd(int& x, int y) {
  if ((x += y) >= 1000000007) x -= 1000000007;
}
void append(int n, int w) {
  int p;
  for (p = lst; s[n] != s[n - len[p] - 1]; p = fail[p])
    ;
  if (!nxt[p][w]) {
    int x = ++cnt, k = fail[p];
    for (; s[n] != s[n - len[k] - 1]; k = fail[k])
      ;
    len[x] = len[p] + 2;
    fail[x] = nxt[k][w];
    nxt[p][w] = x;
    diff[x] = len[x] - len[fail[x]];
    anc[x] = diff[x] == diff[fail[x]] ? anc[fail[x]] : fail[x];
  }
  lst = nxt[p][w];
}
int main() {
  scanf("%s", A + 1);
  n = strlen(A + 1);
  for (int i = 1; i <= n / 2; ++i) {
    s[i * 2 - 1] = A[i];
    s[i * 2] = A[n + 1 - i];
  }
  f[0] = 1;
  lst = cnt = 1;
  fail[0] = 1, fail[1] = 0;
  len[1] = -1;
  for (int i = 1; i <= n; ++i) {
    append(i, s[i] - 'a');
    for (int x = lst; x; x = anc[x]) {
      g[x] = f[i - len[anc[x]] - diff[x]];
      if (anc[x] != fail[x]) upd(g[x], g[fail[x]]);
      if (i % 2 == 0) upd(f[i], g[x]);
    }
  }
  printf("%d", f[n]);
}