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 MAXN = 5005;
const unsigned long long MOD = 1000000007;
const int INF = 1000000000;
int N, nxt[MAXN], cnt[MAXN][MAXN], len[MAXN][MAXN], tot = 1, sh;
string S;
unsigned long long P[MAXN], H[MAXN];
inline unsigned long long get(int p, int l) {
  return (H[p + l] - H[p]) * P[N - p];
}
inline bool comp(int a, int b, int l) {
  int lo = 0, hi = l, mid = (lo + hi) / 2;
  for (; lo < mid; mid = (lo + hi) / 2)
    (get(a, mid) == get(b, mid) ? lo : hi) = mid;
  return S[a + lo] < S[b + lo];
}
void pre() {
  N = S.size();
  int l = 0;
  P[0] = 1;
  for (int i = 0; i < N; i++) {
    P[i + 1] = MOD * P[i];
    H[i + 1] = H[i] + P[i] * S[i];
    nxt[i] = -1;
    while (l <= i && S[i] == '1') nxt[l++] = i;
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= N; j++) {
      if (i == 0) {
        cnt[j][i] = 1;
        len[j][i] = 1;
      } else
        len[j][i] = INF;
    }
  }
}
int main() {
  cin >> S;
  pre();
  int p = 1, v = 0;
  for (int i = N - 1; i >= 0; i--) {
    v = (v + p * (S[i] - '0')) % MOD;
    p = 2 * p % MOD;
  }
  sh = (v + 1) % MOD;
  for (int i = 1; i < N; i++) {
    int t = 0, m = INF, p = i - 1;
    for (int j = i + 1; j <= N; j++) {
      if (S[i] == '0') continue;
      int l = j - i, s = max(i - l, 0);
      if (s == i - l && comp(i, s, l)) s++;
      s = nxt[s];
      if (s < 0) continue;
      for (; p >= s; p--) {
        t = (t + cnt[i][p]) % MOD;
        m = min(m, len[i][p] + 1);
      }
      cnt[j][i] = t;
      len[j][i] = min(m, INF);
      if (j == N) {
        tot = (tot + t) % MOD;
        int p = 1, v = 0;
        for (int k = j - 1; k >= i; k--) {
          v = (v + p * (S[k] - '0')) % MOD;
          p = 2 * p % MOD;
        }
        if (m < INF) {
          if (v < 10000)
            sh = min(sh, v + m);
          else
            sh = (v + m) % MOD;
        }
      }
    }
  }
  cout << tot << '\n' << sh << '\n';
}