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;
int n;
char s[1000000 + 5], t[1000000 + 5];
struct PAM {
  struct node {
    int ch[26];
    int len;
    int fail;
    int d;
    int top;
  } t[1000000 * 2 + 5];
  int ptr, last;
  char *str;
  void ini(char *in) {
    str = in;
    ptr = 1;
    t[0].len = 0;
    t[0].fail = 1;
    t[1].len = -1;
    t[1].fail = 0;
    last = 0;
  }
  int get_fail(int x, int n) {
    while (str[n - t[x].len - 1] != str[n]) x = t[x].fail;
    return x;
  }
  void insert(int c, int pos) {
    int p = get_fail(last, pos);
    if (!t[p].ch[c]) {
      int cur = ++ptr;
      (t[cur].len) = (t[p].len) + 2;
      (t[cur].fail) = t[get_fail((t[p].fail), pos)].ch[c];
      t[cur].d = t[cur].len - t[(t[cur].fail)].len;
      if (t[cur].d == t[(t[cur].fail)].d)
        t[cur].top = t[(t[cur].fail)].top;
      else
        t[cur].top = (t[cur].fail);
      t[p].ch[c] = cur;
    }
    last = t[p].ch[c];
  }
  long long sum[1000000 + 5];
  long long dp[1000000 + 5];
  void solve() {
    dp[0] = 1;
    for (int i = 1; i <= n; i++) {
      insert(str[i] - 'a', i);
      for (int j = last; j > 1; j = t[j].top) {
        sum[j] = dp[i - (t[t[j].top].len) - t[j].d];
        if (t[j].d == t[(t[j].fail)].d)
          sum[j] = (sum[j] + sum[(t[j].fail)]) % 1000000007;
        if (i % 2 == 0) dp[i] = (dp[i] + sum[j]) % 1000000007;
      }
    }
    printf("%lld\n", dp[n]);
  }
} T;
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n / 2; i++) {
    t[2 * i - 1] = s[i];
    t[2 * i] = s[n + 1 - i];
  }
  T.ini(t);
  T.solve();
}