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;
struct palindromic_tree {
  int n, act;
  vector<map<char, int> > list;
  vector<int> link, slink, diff, len;
  string s;
  void add_node() {
    n++;
    list.emplace_back();
    link.emplace_back();
    slink.emplace_back();
    diff.emplace_back();
    len.emplace_back();
  }
  palindromic_tree() {}
  palindromic_tree(string _s) {
    n = -1;
    act = 0;
    list.clear();
    link = slink = diff = len = {};
    s = _s;
    add_node();
    len[0] = -1;
    add_node();
    link[1] = 0;
    act = 1;
  }
  void add_letter(int id) {
    while (act != 0 && s[id] != s[id - len[act] - 1]) act = link[act];
    if (s[id] == s[id - len[act] - 1]) {
      if (list[act][s[id]] == 0) {
        add_node();
        list[act][s[id]] = n;
        len[n] = len[act] + 2;
        if (act != 0) {
          link[n] = link[act];
          while (link[n] != 0 && s[id] != s[id - len[link[n]] - 1])
            link[n] = link[link[n]];
          if (s[id] == s[id - len[link[n]] - 1]) link[n] = list[link[n]][s[id]];
        } else {
          link[n] = 1;
        }
        diff[n] = len[n] - len[link[n]];
        if (diff[n] == diff[link[n]])
          slink[n] = slink[link[n]];
        else
          slink[n] = link[n];
      }
      act = list[act][s[id]];
    }
  }
};
string s, aux;
int n, i, j;
long long dp[1000011], serie[1000011];
int main() {
  cin >> s;
  n = s.size();
  aux = "@";
  i = 0;
  j = n - 1;
  while (i < j) {
    aux.push_back(s[i++]);
    aux.push_back(s[j--]);
  }
  palindromic_tree PT(aux);
  dp[0] = 1;
  for (i = 1; i <= n; i++) {
    PT.add_letter(i);
    for (int act = PT.act; act != 0; act = PT.slink[act]) {
      serie[act] = dp[i - (PT.len[PT.slink[act]] + PT.diff[act])];
      if (PT.diff[act] == PT.diff[PT.link[act]]) {
        serie[act] += serie[PT.link[act]];
        serie[act] %= 1000000007;
      }
      dp[i] += serie[act];
      dp[i] %= 1000000007;
    }
    if (i & 1) dp[i] = 0;
  }
  cout << dp[n];
  return 0;
}