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 long long N = 1e6;
const long long mod = 1e9 + 7;
namespace ModCalc {
inline void Inc(long long &x, long long y) {
  x += y;
  if (x >= mod) x -= mod;
}
inline void Dec(long long &x, long long y) {
  x -= y;
  if (x < 0) x += mod;
}
inline long long Add(long long x, long long y) {
  Inc(x, y);
  return x;
}
inline long long Sub(long long x, long long y) {
  Dec(x, y);
  return x;
}
}  // namespace ModCalc
using namespace ModCalc;
char t[N + 5], s[N + 5];
int n;
long long f[N + 5], g[N + 5], slink[N + 5], diff[N + 5];
struct PAM {
  int nx[N + 5][26], fail[N + 5], len[N + 5];
  int cnt, last;
  void clear() {
    cnt = 1;
    fail[1] = fail[0] = 1;
    len[1] = -1;
  }
  void extend(char c, int n) {
    int id = c - 'a';
    int p = last;
    while (s[n - len[p] - 1] != s[n]) p = fail[p];
    if (!nx[p][id]) {
      cnt++;
      len[cnt] = len[p] + 2;
      int q = fail[p];
      while (s[n - len[q] - 1] != s[n]) q = fail[q];
      fail[cnt] = nx[q][id];
      diff[cnt] = len[cnt] - len[fail[cnt]];
      nx[p][id] = cnt;
      slink[cnt] =
          (diff[cnt] == diff[fail[cnt]] ? slink[fail[cnt]] : fail[cnt]);
    }
    last = nx[p][id];
    p = last;
    while (p >= 2) {
      g[p] = f[n - len[slink[p]] - diff[p]];
      if (diff[p] == diff[fail[p]]) Inc(g[p], g[fail[p]]);
      if (!(n & 1)) Inc(f[n], g[p]);
      p = slink[p];
    }
  }
} P;
int main() {
  scanf("%s", t + 1);
  n = strlen(t + 1);
  if (n & 1) {
    puts("0");
    return 0;
  }
  int _n = 0;
  for (register int i = 1; (i << 1) <= n; i++) {
    s[++_n] = t[i];
    s[++_n] = t[n + 1 - i];
  }
  P.clear();
  f[0] = 1;
  for (register int i = 1; i <= n; i++) P.extend(s[i], i);
  cout << f[n] << endl;
  return 0;
}