Problem: Dreamoon saw a large integer x written on the ground and wants to print its binary form out. Dreamoon has accomplished the part of turning x into its binary format. Now he is going to print it in the following manner.

He has an integer n = 0 and can only perform the following two operations in any order for unlimited times each:

  1. Print n in binary form without leading zeros, each print will append to the right of previous prints. 
  2. Increase n by 1. 



Let's define an ideal sequence as a sequence of operations that can successfully print binary representation of x without leading zeros and ends with a print operation (i.e. operation 1). Dreamoon wants to know how many different ideal sequences are there and the length (in operations) of the shortest ideal sequence.

The answers might be large so please print them modulo 1000000007 (109 + 7).

Let's define the string representation of an ideal sequence as a string of '1' and '2' where the i-th character in the string matches the i-th operation performed. Two ideal sequences are called different if their string representations are different.

Input

The single line of the input contains a binary integer representing x (1 ≤ x < 25000) without leading zeros.

Output

The first line of the output should contain an integer representing the number of different ideal sequences modulo 1000000007 (109 + 7).

The second line of the output contains an integer representing the minimal length of an ideal sequence modulo 1000000007 (109 + 7).

Examples

Input

101


Output

1
6


Input

11010


Output

3
5

Note

For the first sample, the shortest and the only ideal sequence is «222221» of length 6.

For the second sample, there are three ideal sequences «21211», «212222222221», «222222222222222222222222221». Among them the shortest one has length 5.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int mdl = 1000000007LL;
string s;
int n, gap;
vector<int> sa, pos, satmp, lcp;
bool cmp(int i, int j) {
  if (pos[i] != pos[j]) return pos[i] < pos[j];
  i += gap;
  j += gap;
  if (i < n && j < n) return pos[i] < pos[j];
  return i > j;
}
void buildsa() {
  n = (int((s).size()));
  sa = pos = satmp = lcp = vector<int>(n, 0);
  for (int i = 0; i < (n); ++i) {
    sa[i] = i;
    pos[i] = s[i];
  }
  for (gap = 1;; gap *= 2) {
    sort((sa).begin(), (sa).end(), cmp);
    satmp[0] = 0;
    for (int i = 0; i < (n - 1); ++i)
      satmp[i + 1] = satmp[i] + cmp(sa[i], sa[i + 1]);
    for (int i = 0; i < (n); ++i) pos[sa[i]] = satmp[i];
    if (satmp[n - 1] == n - 1) break;
  }
}
void buildlcp() {
  int k = 0;
  for (int i = 0; i < (n); ++i) {
    if (pos[i] == n - 1) continue;
    for (int j = sa[pos[i] + 1]; i + k < n && j + k < n && s[i + k] == s[j + k];
         ++k)
      ;
    lcp[pos[i]] = k;
    if (k) --k;
  }
}
string x;
vector<vector<int> > wtdup, spaup, minlcp;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> x;
  s = x;
  buildsa();
  buildlcp();
  int n = (int((x).size()));
  wtdup.resize(n + 1, vector<int>(n + 1, 0));
  spaup.resize(n + 1, vector<int>(n + 1, -1));
  minlcp.resize(n + 1, vector<int>(n + 1, 1000000000));
  for (int i = 0; i < (n - 1); ++i) {
    minlcp[i][i] = lcp[i];
    for (int j = i + 1; j < n - 1; ++j)
      minlcp[i][j] = min(lcp[j], minlcp[i][j - 1]);
  }
  int critst, crited;
  vector<int> spsol(n + 1, -1);
  for (int ed = 0; ed < (n); ++ed) {
    for (int st = ed; st >= 0; st--) {
      if (x[st] == '0') {
        wtdup[ed][st] = wtdup[ed][st + 1];
        spaup[ed][st] = spaup[ed][st + 1];
        continue;
      }
      crited = st - 1;
      critst = crited + (st - ed);
      if (st == 0) {
        wtdup[ed][st] = (wtdup[ed][st + 1] + 1);
        if (wtdup[ed][st] == mdl) wtdup[ed][st] = 0;
        spaup[ed][st] = 1;
        spsol[0] = 1;
        continue;
      }
      if (critst >= 0) {
        if (pos[st] < pos[critst] &&
            minlcp[pos[st]][pos[critst] - 1] <= ed - st)
          ++critst;
      } else
        critst = 0;
      wtdup[ed][st] = wtdup[ed][st + 1] + wtdup[crited][critst];
      if (wtdup[ed][st] >= mdl) wtdup[ed][st] -= mdl;
      spaup[ed][st] = 1 + spaup[crited][critst];
      if (spaup[ed][st] == 0) spaup[ed][st] = -1;
      spsol[st] = spaup[ed][st];
      if (spaup[ed][st] == -1)
        spaup[ed][st] = spaup[ed][st + 1];
      else {
        if (spaup[ed][st + 1] != -1)
          spaup[ed][st] = min(spaup[ed][st], spaup[ed][st + 1]);
      }
    }
  }
  cout << wtdup[n - 1][0] << endl;
  int bst = mdl + 3;
  for (int i = n - 1; i >= 0; i--) {
    if (n - 1 - i >= 20 && bst != mdl + 3) break;
    if (spsol[i] == -1) continue;
    int cloc = i;
    int cn = 0;
    while (cloc <= n - 1) {
      cn *= 2;
      cn += (x[cloc] - '0');
      cn %= mdl;
      ++cloc;
    }
    cn += spsol[i];
    cn %= mdl;
    bst = min(bst, cn);
  }
  cout << bst % mdl << endl;
  return 0;
}