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>
namespace QiShiBuShiTaoLuTi2333 {
const int N = 1000100, INF = 1000000007, MOD = 1000000007;
inline void inc(int a, int &b) { b = (a + b) % MOD; }
struct node {
  int pos, delta, k;
  int lastpos() { return pos + delta * (k - 1); }
  node(int a = 0, int b = 0, int c = 0) : pos(a), delta(b), k(c) {}
  bool operator<(const node &A) const { return pos < A.pos; }
};
std::vector<node> G[N];
char s[N], t[N];
int n;
void calc(int p) {
  std::vector<node> G0, G1;
  for (auto A : G[p - 1]) {
    node B = A;
    B.pos--;
    if (t[A.pos - 1] == t[p]) G0.push_back(B);
  }
  for (int i = 0; i < (int)G0.size(); i++) {
    if (!i) {
      G1.push_back(node(G0[i].pos, INF, 1));
      if (G0[i].k > 1)
        G1.push_back(node(G0[i].pos + G0[i].delta, G0[i].delta, G0[i].k - 1));
    } else if (G0[i].pos - G0[i - 1].lastpos() != G0[i].delta) {
      G1.push_back(node(G0[i].pos, G0[i].pos - G0[i - 1].lastpos(), 1));
      if (G0[i].k > 1)
        G1.push_back(node(G0[i].pos + G0[i].delta, G0[i].delta, G0[i].k - 1));
    } else
      G1.push_back(G0[i]);
  }
  if (p > 1 && t[p] == t[p - 1]) {
    if (G1.empty())
      G1.push_back(node(p - 1, INF, 1));
    else
      G1.push_back(node(p - 1, p - 1 - G1[G1.size() - 1].lastpos(), 1));
  }
  if (G1.empty())
    G1.push_back(node(p, INF, 1));
  else
    G1.push_back(node(p, p - G1[G1.size() - 1].lastpos(), 1));
  int tot = 0;
  G[p].push_back(G1[0]);
  for (int i = 1; i < (int)G1.size(); i++) {
    if (G[p][tot].delta == G1[i].delta)
      G[p][tot].k += G1[i].k;
    else
      G[p].push_back(G1[i]), tot++;
  }
}
int f[N];
void initialize() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n / 2; i++) t[i * 2 - 1] = s[i];
  for (int i = 1; i <= n / 2; i++) t[i * 2] = s[n - i + 1];
}
int sum[N];
void solve() {
  initialize();
  f[0] = 1;
  for (int i = 1; i <= n; i++) {
    calc(i);
    for (auto A : G[i]) {
      int x = A.pos - A.delta, u = A.lastpos(), res = 0;
      inc(f[u - 1], res);
      if (A.k > 1) inc(sum[x], res);
      if (x > 0) sum[x] = res;
      inc(res, f[i]);
    }
    if (i & 1) f[i] = 0;
  }
  printf("%d\n", f[n]);
}
}  // namespace QiShiBuShiTaoLuTi2333
int main() {
  QiShiBuShiTaoLuTi2333::solve();
  return 0;
}