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 P = 1000000007;
int add(int a, int b) {
  int r = a + b;
  return r < P ? r : r - P;
}
int sub(int a, int b) {
  int r = a - b;
  return r < 0 ? r + P : r;
}
namespace pam {
char s[1 << 20];
int g[1 << 20][26], f[1 << 20], l[1 << 20], d[1 << 20], t[1 << 20], nc;
int dp[1 << 20], v[1 << 20];
int gn(int len) {
  int p = nc++;
  l[p] = len;
  f[p] = 0;
  fill_n(g[p], 26, 0);
  return p;
}
void clr() {
  nc = 0;
  gn(0);
  gn(-1);
  f[0] = 1;
  f[1] = -1;
  s[0] = 1;
}
int getf(int p, int i) {
  while (s[i] != s[i - l[p] - 1]) p = f[p];
  return p;
}
int extend(int p, int o, int i) {
  s[i] = o + 'a';
  p = getf(p, i);
  int& q = g[p][o];
  if (!q) {
    q = gn(l[p] + 2);
    if (p != 1) f[q] = g[getf(f[p], i)][o];
    d[q] = l[q] - l[f[q]];
    t[q] = d[f[q]] == d[q] ? t[f[q]] : f[q];
  }
  for (int r = q; r > 1; r = t[r]) {
    v[r] = dp[i - l[t[r]] - d[r]];
    if (d[r] == d[f[r]]) v[r] = add(v[r], v[f[r]]);
    if (i % 2 == 0) dp[i] = add(dp[i], v[r]);
  }
  return q;
}
}  // namespace pam
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  int n = s.size();
  string t(n, '0');
  for (int i = 0; i != n / 2; ++i) {
    t[2 * i + 1] = s[i];
    t[2 * i] = s[n - i - 1];
  }
  pam::dp[0] = 1;
  pam::clr();
  int p = 0;
  for (int i = 0; i != n; ++i) p = pam::extend(p, t[i] - 'a', i + 1);
  cout << pam::dp[n] << endl;
  return 0;
}