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 MX = 1e6 + 5, SIG = 26;
int str[MX], len[MX], link[MX], to[MX][SIG], slink[MX], dif[MX];
int cur, sl, sz;
void init() {
  memset(to, 0, sizeof(to));
  cur = sl = 0;
  str[sl++] = -1;
  link[0] = 1, len[0] = 0;
  link[1] = 0, len[1] = -1;
  sz = 2;
}
int getLink(int v) {
  while (str[sl - len[v] - 2] != str[sl - 1]) v = link[v];
  return v;
}
void insert(int c) {
  str[sl++] = c;
  cur = getLink(cur);
  if (!to[cur][c]) {
    len[sz] = len[cur] + 2;
    link[sz] = to[getLink(link[cur])][c];
    dif[sz] = len[sz] - len[link[sz]];
    if (dif[sz] == dif[link[sz]])
      slink[sz] = slink[link[sz]];
    else
      slink[sz] = link[sz];
    to[cur][c] = sz++;
  }
  cur = to[cur][c];
}
const int mod = 1e9 + 7;
string s, in;
int dp[MX], acu[MX];
void sum(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> in;
  for (int i = 0; s.size() < in.size(); i++)
    s.push_back(in[i]), s.push_back(in[in.size() - i - 1]);
  init();
  dp[0] = 1;
  for (int i = 1; i <= s.size(); i++) {
    insert(s[i - 1] - 'a');
    for (int j = cur; j > 1; j = slink[j]) {
      acu[j] = dp[i - len[slink[j]] - dif[j]];
      if (dif[j] == dif[link[j]]) sum(acu[j], acu[link[j]]);
      sum(dp[i], acu[j]);
    }
    if (i % 2) dp[i] = 0;
  }
  cout << dp[s.size()] << '\n';
  return 0;
}