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 mod = 1e9 + 7;
const int maxn = 1e6 + 5;
void update(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
struct Palindromic_Tree {
  int next[maxn][26];
  int fail[maxn];
  int len[maxn];
  int S[maxn];
  int last;
  int diff[maxn], slink[maxn], fp[maxn];
  int n;
  int p;
  int newnode(int l) {
    for (int i = 0; i < 26; ++i) next[p][i] = 0;
    len[p] = l;
    return p++;
  }
  void init() {
    p = 0;
    newnode(0);
    newnode(-1);
    last = 0;
    n = 0;
    S[n] = -1;
    fail[0] = 1;
  }
  int get_fail(int x) {
    while (S[n - len[x] - 1] != S[n]) x = fail[x];
    return x;
  }
  int add(int c) {
    c -= 'a';
    S[++n] = c;
    int cur = get_fail(last);
    if (!next[cur][c]) {
      int now = newnode(len[cur] + 2);
      fail[now] = next[get_fail(fail[cur])][c];
      next[cur][c] = now;
      diff[now] = len[now] - len[fail[now]];
      slink[now] =
          (diff[now] == diff[fail[now]] ? slink[fail[now]] : fail[now]);
    }
    last = next[cur][c];
    return last;
  }
  void solve(int dp[], char s[], int n) {
    int i, j;
    init();
    dp[0] = 1;
    for (i = 1; i <= n; i++) {
      for (j = add(s[i]); j; j = slink[j]) {
        fp[j] = dp[i - (len[slink[j]] + diff[j])];
        if (diff[j] == diff[fail[j]]) update(fp[j], fp[fail[j]]);
        if (!(i & 1)) update(dp[i], fp[j]);
      }
    }
  }
} Pt;
char s1[maxn], ss[maxn];
int ans[maxn];
int main() {
  int n, i, l, r;
  scanf(" %s", s1);
  n = strlen(s1);
  for (i = 1, l = 0, r = n - 1; i <= n; i++) {
    if (i & 1)
      ss[i] = s1[l++];
    else
      ss[i] = s1[r--];
  }
  memset(ans, 0, sizeof(ans));
  Pt.solve(ans, ss, n);
  printf("%d\n", ans[n]);
  return 0;
}