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 = 1000005;
const int mod = 1e9 + 7;
namespace pam {
int ch[N][26], fail[N], dif[N], slink[N], cnt[N], dep[N], len[N];
int sz, tot, lst;
char s[N];
int new_node(int lenn) {
  ++sz;
  memset(ch[sz], 0, sizeof(ch[sz]));
  len[sz] = lenn;
  cnt[sz] = dep[sz] = fail[sz] = 0;
  return sz;
}
void clear() {
  lst = tot = 0;
  sz = -1;
  s[tot] = '$';
  new_node(0);
  new_node(-1);
  fail[0] = 1;
}
int get_fail(int x) {
  while (s[tot - len[x] - 1] != s[tot]) x = fail[x];
  return x;
}
void insert(char c) {
  s[++tot] = c;
  int now = get_fail(lst), v = (int)c - (int)'a';
  if (!ch[now][v]) {
    int x = new_node(len[now] + 2);
    fail[x] = ch[get_fail(fail[now])][v];
    dep[x] = dep[fail[x]] + 1;
    ch[now][v] = x;
    dif[x] = len[x] - len[fail[x]];
    if (dif[x] == dif[fail[x]])
      slink[x] = slink[fail[x]];
    else
      slink[x] = fail[x];
  }
  lst = ch[now][v];
  ++cnt[lst];
}
}  // namespace pam
inline void upd(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
  return;
}
using pam::dif;
using pam::fail;
using pam::len;
using pam::slink;
int n;
int dp[N], g[N];
char s[N], t[N << 1];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  pam::clear();
  for (int i = 1, j = 0; i <= n; ++i) t[++j] = s[i], t[++j] = s[n - i + 1];
  dp[0] = 1;
  for (int i = 1; i <= n; ++i) {
    pam::insert(t[i]);
    for (int x = pam::lst; x > 1; x = slink[x]) {
      g[x] = dp[i - len[slink[x]] - dif[x]];
      if (dif[x] == dif[fail[x]]) upd(g[x], g[fail[x]]);
      if (!(i & 1)) upd(dp[i], g[x]);
    }
  }
  printf("%d\n", dp[n]);
  return 0;
}