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 = 1000000 + 2;
const int M = 1000000007;
const int A = 26;
void add(int &a, int b) {
  a += b;
  if (a >= M) {
    a -= M;
  }
}
int series_link[N], series[N], diff[N];
int link[N], length[N], to[N][A];
string t;
int get(int u, int i) {
  while (true) {
    int j = i - 1 - length[u];
    if (j >= 0 && t[j] == t[i]) {
      break;
    }
    u = link[u];
  }
  return u;
}
int ways[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  int n = s.size();
  for (int i = 0; i < n / 2; ++i) {
    t += s[i], t += s[n - 1 - i];
  }
  int u = 0, m = 2;
  length[1] = -1;
  link[0] = 1;
  ways[0] = 1;
  for (int i = 0; i < n; ++i) {
    u = get(u, i);
    if (to[u][t[i] - 'a'] == 0) {
      length[m] = length[u] + 2;
      link[m] = to[get(link[u], i)][t[i] - 'a'];
      diff[m] = length[m] - length[link[m]];
      if (diff[m] == diff[link[m]]) {
        series_link[m] = series_link[link[m]];
      } else {
        series_link[m] = link[m];
      }
      to[u][t[i] - 'a'] = m++;
    }
    u = to[u][t[i] - 'a'];
    for (int v = u; length[v] > 0; v = series_link[v]) {
      series[v] = ways[i + 1 - length[series_link[v]] - diff[v]];
      if (diff[v] == diff[link[v]]) {
        add(series[v], series[link[v]]);
      }
      add(ways[i + 1], series[v]);
    }
    if (i % 2 == 0) {
      ways[i + 1] = 0;
    }
  }
  cout << ways[n] << "\n";
}