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>
bool m1;
FILE *Input = stdin, *Output = stdout;
const int maxn = 1e6 + 5, Mod = 1e9 + 7, maxa = 30;
int trans[maxn][maxa], link[maxn], len[maxn], totn;
int diff[maxn], slink[maxn], dp[maxn], Sum[maxn];
int S[maxn], pos[maxn];
char Buf[maxn];
bool m2;
int Plus(int ar1, int ar2, int ar3) {
  return ar3 - ar1 <= ar2 ? ar1 - ar3 + ar2 : ar1 + ar2;
}
int Minu(int ar1, int ar2, int ar3) {
  return ar1 - ar2 < 0 ? ar1 - ar2 + ar3 : ar1 - ar2;
}
int Mul(int ar1, int ar2, int ar3) {
  return 1LL * ar1 * ar2 >= ar3 ? 1LL * ar1 * ar2 % ar3 : ar1 * ar2;
}
void Build_PAM(int ar1[], int ar2) {
  totn = 2;
  len[1] = -1;
  len[2] = 0;
  link[2] = 1;
  int nowlast = 2;
  for (int i = 1; i <= ar2; i++) {
    int now = nowlast;
    while (ar1[i] != ar1[i - len[now] - 1]) now = link[now];
    if (!trans[now][ar1[i]]) {
      trans[now][ar1[i]] = ++totn;
      len[totn] = len[now] + 2;
      if (~len[now]) {
        int nowlink = link[now];
        while (ar1[i] != ar1[i - len[nowlink] - 1]) nowlink = link[nowlink];
        link[totn] = trans[nowlink][ar1[i]];
      } else
        link[totn] = 2;
      diff[totn] = len[totn] - len[link[totn]];
      slink[totn] =
          (diff[totn] == diff[link[totn]] ? slink[link[totn]] : link[totn]);
    }
    nowlast = trans[now][ar1[i]];
    pos[i] = nowlast;
  }
}
int main() {
  fscanf(Input, "%s", Buf + 1);
  int n = strlen(Buf + 1);
  for (int i = 1; i <= n; i++)
    S[i] = (i & 1 ? Buf[(i >> 1) + 1] : Buf[n - (i >> 1) + 1]) - 96;
  Build_PAM(S, n);
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = pos[i]; j != 2; j = slink[j]) {
      Sum[j] = Plus(link[j] == slink[j] ? 0 : Sum[link[j]],
                    dp[i - len[slink[j]] - diff[j]], Mod);
      if (!(i & 1)) dp[i] = Plus(dp[i], Sum[j], Mod);
    }
  }
  fprintf(Output, "%d\n", dp[n]);
  fclose(Input);
  fclose(Output);
  return 0;
}