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 N = 1234567, mod = 1e9 + 7;
void add(int& x, int y) {
  x += y;
  if (x >= mod) {
    x -= mod;
  }
}
int n, last, tt, ch[N][26], father[N], len[N], diff[N], anc[N], sum[N], dp[N];
string r, s, t;
int new_node(int from) {
  len[++tt] = len[from] + 2;
  return tt;
}
int extend(int i, int c) {
  int p = last;
  while (t[i - 1 - len[p]] - 'a' != c) {
    p = father[p];
  }
  if (!ch[p][c]) {
    int np = new_node(p), q = father[p];
    while (t[i - 1 - len[q]] - 'a' != c) {
      q = father[q];
    }
    father[np] = ch[q][c];
    diff[np] = len[np] - len[father[np]];
    anc[np] = diff[np] == diff[father[np]] ? anc[father[np]] : father[np];
    ch[p][c] = np;
  }
  return last = ch[p][c];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> r;
  n = r.length();
  if (n & 1) {
    cout << 0 << '\n';
    exit(0);
  }
  for (int i = 0; i < (n >> 1); ++i) {
    s.push_back(r[i]);
    s.push_back(r[n - i - 1]);
  }
  tt = 1;
  len[1] = -1;
  father[0] = 1;
  t.push_back('z' + 1);
  dp[0] = 1;
  for (int i = 1; i <= n; ++i) {
    t.push_back(s[i - 1]);
    int here = extend(i, s[i - 1] - 'a');
    for (int j = here; j > 1; j = anc[j]) {
      sum[j] = dp[i - (len[anc[j]] + diff[j])];
      if (father[j] != anc[j]) {
        add(sum[j], sum[father[j]]);
      }
      if (!(i & 1)) {
        add(dp[i], sum[j]);
      }
    }
  }
  cout << dp[n] << '\n';
  return 0;
}