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 MAXN = 1000005;
string s;
struct PalindromicTree {
  int N, cur;
  vector<map<int, int>> next;
  vector<int> link, start, len, diff, slink;
  PalindromicTree() : N(0), cur(0) {
    node();
    len[0] = -1;
    node();
  }
  int node() {
    next.emplace_back();
    link.emplace_back(0);
    start.emplace_back(0);
    len.emplace_back(0);
    diff.emplace_back(0);
    slink.emplace_back(0);
    return N++;
  }
  void add_letter(int idx) {
    while (true) {
      if (idx - len[cur] - 1 >= 0 && s[idx - len[cur] - 1] == s[idx]) break;
      cur = link[cur];
    }
    if (next[cur].find(s[idx]) != next[cur].end()) {
      cur = next[cur][s[idx]];
      return;
    }
    node();
    next[cur][s[idx]] = N - 1;
    len[N - 1] = len[cur] + 2;
    start[N - 1] = idx - len[N - 1] + 1;
    if (len[N - 1] == 1) {
      link[N - 1] = diff[N - 1] = slink[N - 1] = 1;
      cur = N - 1;
      return;
    }
    while (true) {
      cur = link[cur];
      if (idx - len[cur] - 1 >= 0 && s[idx - len[cur] - 1] == s[idx]) break;
    }
    link[N - 1] = next[cur][s[idx]];
    diff[N - 1] = len[N - 1] - len[link[N - 1]];
    if (diff[N - 1] == diff[link[N - 1]])
      slink[N - 1] = slink[link[N - 1]];
    else
      slink[N - 1] = link[N - 1];
    cur = N - 1;
  }
};
long long dp[MAXN], sans[MAXN];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  PalindromicTree pt;
  int i, cur;
  string str;
  cin >> str;
  for (i = 0; i < (int)str.size() / 2; i++) {
    s.push_back(str[i]);
    s.push_back(str[(int)str.size() - i - 1]);
  }
  dp[0] = 1;
  for (i = 1; i <= (int)s.size(); i++) {
    pt.add_letter(i - 1);
    for (cur = pt.cur; cur > 1; cur = pt.slink[cur]) {
      sans[cur] = dp[i - pt.len[pt.slink[cur]] - pt.diff[cur]];
      if (pt.diff[cur] == pt.diff[pt.link[cur]])
        sans[cur] = (sans[cur] + sans[pt.link[cur]]) % 1000000007;
      dp[i] = (dp[i] + sans[cur]) % 1000000007;
    }
    if (i & 1) dp[i] = 0;
  }
  cout << dp[(int)s.size()];
  return 0;
}