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 MOD = 1e9 + 7;
long long L, pos, newp = 1, now, last;
long long g[1000002], dp[1000002];
char s[1000002], t[1000002];
struct Node {
  int fail, len, cnt, diff, slink;
  int ch[26];
} pam[1000005];
int GetFail(int p) {
  while (t[pos] != t[pos - 1 - pam[p].len]) p = pam[p].fail;
  return p;
}
void Insert(char c) {
  int x = c - 'a', f;
  now = GetFail(last);
  if (!pam[now].ch[x]) {
    pam[++newp].len = pam[now].len + 2;
    f = pam[newp].fail = pam[GetFail(pam[now].fail)].ch[x];
    pam[now].ch[x] = newp;
    pam[newp].diff = pam[newp].len - pam[f].len;
    if (pam[newp].diff == pam[f].diff)
      pam[newp].slink = pam[f].slink;
    else
      pam[newp].slink = f;
  }
  ++pam[last = pam[now].ch[x]].cnt;
}
int main() {
  scanf("%s", s + 1);
  L = strlen(s + 1);
  for (int i = 1, j = 0; j < L; ++i) t[++j] = s[i], t[++j] = s[L - i + 1];
  pam[0].fail = pam[1].fail = 1, pam[1].len = -1, dp[0] = 1;
  for (pos = 1; pos <= L; ++pos) {
    Insert(t[pos]);
    for (int x = last; x > 1; x = pam[x].slink) {
      g[x] = dp[pos - pam[pam[x].slink].len - pam[x].diff];
      if (pam[x].diff == pam[pam[x].fail].diff)
        g[x] = (g[x] + g[pam[x].fail]) % MOD;
      if (pos % 2 == 0) dp[pos] = (dp[pos] + g[x]) % MOD;
    }
  }
  printf("%lld\n", dp[L]);
  return 0;
}