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;
int i, j, m, k, res, n;
int M[5001][5001], D[5001][5001], DP[5001][5001];
char Xb[5001];
int main() {
  scanf("%s", Xb);
  n = strlen(Xb);
  for (i = n - 1; i >= 0; i--)
    for (j = 0; j < n; j++)
      if (Xb[i] == Xb[j])
        M[i][j] = M[i + 1][j + 1] + 1;
      else
        M[i][j] = 0;
  D[0][1] = 1;
  for (i = 0; i < 5001; i++) fill(DP[i], DP[i] + 5001, 1000000000);
  DP[0][1] = 1;
  for (j = 0; j < n; j++) {
    for (i = 0; i < j; i++) {
      D[i][j + 1] = (D[i][j + 1] + D[i][j]) % 1000000007;
      DP[i][j + 1] = min(DP[i][j + 1], DP[i][j]);
      m = M[i][j];
      if (m >= j - i || (j + m < n && Xb[i + m] < Xb[j + m]))
        k = 2 * j - i;
      else
        k = 2 * j - i + 1;
      if (k <= n && Xb[j] == '1') {
        D[j][k] = (D[j][k] + D[i][j]) % 1000000007;
        DP[j][k] = min(DP[j][k], DP[i][j] + 1);
      }
    }
  }
  for (i = 0; i < n; i++) res = (res + D[i][n]) % 1000000007;
  long long ans1 = D[0][n];
  int ans2 = 0;
  long long dif = 1;
  for (int s = 1; s < n; s++) {
    if (DP[s][n] < 1000000000) {
      ans1 = (ans1 + D[s][n]) % 1000000007;
      long long val = DP[s][n] - DP[ans2][n];
      if (val <= 0 || s - ans2 > 12 || n - s > 12 ||
          dif * (1 << (n - s)) >= val) {
        dif = 0;
        ans2 = s;
      }
    }
    dif = (dif << 1) + Xb[s] - '0';
  }
  long long ans2val = 0;
  for (int i = ans2; i < n; i++)
    ans2val = ((ans2val << 1) + Xb[i] - '0') % 1000000007;
  ans2val = (ans2val + DP[ans2][n]) % 1000000007;
  printf("%d\n%d\n", res, (int)ans2val);
  return 0;
}