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;
inline int read() {
  register int x = 0, t = 1;
  register char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') t = -1, ch = getchar();
  while (ch <= '9' && ch >= '0') x = x * 10 + ch - 48, ch = getchar();
  return x * t;
}
char ch[1000100], s[1000100];
int n, anc[1000100], diff[1000100];
int ans[1000100], f[1000100];
struct Palindromic_Tree {
  struct Node {
    int son[26];
    int ff, len;
  } t[1000100];
  int last, tot;
  void init() {
    t[tot = 1].len = -1;
    t[0].ff = t[1].ff = 1;
    anc[0] = 1;
  }
  void extend(int c, int n, char *s) {
    int p = last;
    while (s[n - t[p].len - 1] != s[n]) p = t[p].ff;
    if (!t[p].son[c]) {
      int v = ++tot, k = t[p].ff;
      t[v].len = t[p].len + 2;
      while (s[n - t[k].len - 1] != s[n]) k = t[k].ff;
      t[v].ff = t[k].son[c];
      t[p].son[c] = v;
      diff[v] = t[v].len - t[t[v].ff].len;
      anc[v] = (diff[v] == diff[t[v].ff]) ? anc[t[v].ff] : t[v].ff;
    }
    last = t[p].son[c];
  }
} PT;
int main() {
  PT.init();
  scanf("%s", ch + 1);
  n = strlen(ch + 1);
  if (n & 1) {
    puts("0");
    return 0;
  }
  for (int i = 1; i <= n; i += 2) s[i] = ch[(i + 1) / 2];
  reverse(&ch[1], &ch[n + 1]);
  for (int i = 2; i <= n; i += 2) s[i] = ch[(i + 1) / 2];
  ans[0] = 1;
  for (int i = 1; i <= n; ++i) {
    PT.extend(s[i] - 97, i, s);
    for (int k = PT.last; k; k = anc[k]) {
      f[k] = ans[i - PT.t[anc[k]].len - diff[k]];
      if (anc[k] != PT.t[k].ff) f[k] = (f[k] + f[PT.t[k].ff]) % 1000000007;
      if (!(i & 1)) ans[i] = (ans[i] + f[k]) % 1000000007;
    }
  }
  printf("%d\n", ans[n]);
  return 0;
}