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 p = 1e9 + 7;
char ch[1000012], s[1000012];
int cz[1000012][27], fl[1000012], len[1000012], la, js, n, dp[1000012],
    dif[1000012], slink[1000012], g[1000012];
void ada(char c, int wh) {
  int p = la;
  while (ch[wh - len[p] - 1] != c) p = fl[p];
  if (!cz[p][c - 'a']) {
    ++js;
    len[js] = len[p] + 2;
    int tp = fl[p];
    while (ch[wh - len[tp] - 1] != c) tp = fl[tp];
    fl[js] = cz[tp][c - 'a'];
    cz[p][c - 'a'] = js;
    dif[js] = len[js] - len[fl[js]];
    if (dif[js] == dif[fl[js]])
      slink[js] = slink[fl[js]];
    else
      slink[js] = fl[js];
  }
  la = cz[p][c - 'a'];
}
bool cmp(int x, int y) { return len[x] > len[y]; }
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  int tot = 0;
  for (int i = 1, j = n; i < j; i++, j--) ch[++tot] = s[i], ch[++tot] = s[j];
  fl[0] = 1;
  fl[1] = 1;
  len[1] = -1;
  js = la = 1;
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    ada(ch[i], i);
    for (int x = la; x > 1; x = slink[x]) {
      g[x] = dp[i - dif[x] - len[slink[x]]];
      if (dif[x] == dif[fl[x]]) g[x] = (g[x] + g[fl[x]]) % p;
      if (i % 2 == 0) dp[i] = (dp[i] + g[x]) % p;
    }
  }
  printf("%d\n", dp[n]);
}