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 N = 1000005, M = 1e9 + 7;
int len[N], fail[N], dp[N], ne[N][26], diff[N], pre[N], tot, last, f[N];
char s1[N], s[N];
inline int getfail(int x, int y) {
  while (s1[y] != s1[y - len[x] - 1]) x = fail[x];
  return x;
}
inline void insert(int x, int y) {
  int now = getfail(last, y);
  if (!ne[now][x]) {
    tot++;
    len[tot] = len[now] + 2;
    fail[tot] = ne[getfail(fail[now], y)][x];
    ne[now][x] = tot;
    diff[tot] = len[tot] - len[fail[tot]];
    if (diff[tot] == diff[fail[tot]])
      pre[tot] = pre[fail[tot]];
    else
      pre[tot] = fail[tot];
  }
  last = ne[now][x];
}
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  tot = 1;
  last = 0;
  len[1] = -1;
  fail[0] = pre[0] = 1;
  for (int i = 1; i <= n; i++)
    if (i & 1)
      s1[i] = s[i / 2 + 1];
    else
      s1[i] = s[n - i / 2 + 1];
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    insert(s1[i] - 'a', i);
    for (int j = last; j; j = pre[j]) {
      f[j] = dp[i - len[pre[j]] - diff[j]];
      if (pre[j] != fail[j]) (f[j] += f[fail[j]]) %= M;
      if (!(i & 1)) (dp[i] += f[j]) %= M;
    }
  }
  printf("%d\n", dp[n]);
}