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 M = 1000000007, N = 1000005;
int n, m, ch[N][26], len[N], tot, k, i, j, las, fail[N];
int d[N], g[N];
char cc[N], c[N];
long long dp[N], f[N];
int main() {
  scanf("%s", cc + 1);
  n = strlen(cc + 1);
  len[1] = -1;
  fail[0] = 1;
  for (i = 1; i <= n / 2; ++i) {
    c[++k] = cc[i];
    c[++k] = cc[n - i + 1];
  }
  tot = 1;
  dp[0] = 1;
  for (i = 1; i <= n; ++i) {
    int p = las;
    while (c[i - len[p] - 1] != c[i]) p = fail[p];
    if (ch[p][c[i] - 'a'] == 0) {
      int v = p;
      p = fail[p];
      while (c[i - len[p] - 1] != c[i]) p = fail[p];
      fail[++tot] = ch[p][c[i] - 'a'];
      ch[v][c[i] - 'a'] = tot;
      len[tot] = len[v] + 2;
      las = tot;
      d[tot] = len[tot] - len[fail[tot]];
      if (d[tot] == d[fail[tot]])
        g[tot] = g[fail[tot]];
      else
        g[tot] = fail[tot];
    } else
      las = ch[p][c[i] - 'a'];
    p = las;
    while (p) {
      f[p] = dp[i - d[p] - len[g[p]]];
      if (g[p] != fail[p]) f[p] = (f[p] + f[fail[p]]) % M;
      if ((i & 1) ^ 1) dp[i] = (dp[i] + f[p]) % M;
      p = g[p];
    }
  }
  cout << dp[n];
}