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 Mod = 1e9 + 7;
const int N = 1e6 + 4;
inline int FIX(int a) { return (a % Mod + Mod) % Mod; }
int lcp[5000 + 5][5000 + 5], dp[5000 + 5][5000 + 5];
void cal(const string &x) {
  int L = ((int)x.length());
  for (int i = L - 1; i >= 0; i--) {
    for (int j = i + 1; j < L; j++) {
      if (x[i] == x[j])
        lcp[i][j] = lcp[i + 1][j + 1] + 1;
      else
        lcp[i][j] = 0;
    }
  }
  return;
}
int main() {
  string x;
  cin >> x;
  cal(x);
  int L = ((int)x.length());
  dp[0][0] = 1;
  int res = 0;
  for (int i = 0; i < L; i++) {
    for (int j = i; j < L; j++) {
      dp[i][j] = (dp[i][j] + dp[i][j - 1]) % Mod;
      if (j + 1 >= L || x[j + 1] == '0' || j + 1 + (j - i + 1) - 1 >= L)
        continue;
      int curl = lcp[i][j + 1], pos;
      if (curl >= j - i + 1 || x[i + curl] < x[j + 1 + curl]) {
        pos = j + 1 + (j - i + 1) - 1;
      } else {
        pos = j + 1 + (j - i + 1);
      }
      if (j + 1 < L && pos < L)
        dp[j + 1][pos] = (dp[j + 1][pos] + dp[i][j]) % Mod;
    }
  }
  for (int i = 0; i < L; i++) {
    res = (res + dp[i][L - 1]) % Mod;
  }
  cout << res << endl;
  const int MAX = 100000000;
  for (int i = 0; i < L; i++)
    for (int j = i; j < L; j++) dp[i][j] = MAX;
  dp[0][0] = 1;
  for (int i = 0; i < L; i++) {
    int curmin = MAX;
    for (int j = i; j < L; j++) {
      curmin = min(curmin, dp[i][j]);
      dp[i][j] = curmin;
      if (j + 1 >= L || x[j + 1] == '0' || j + 1 + (j - i + 1) - 1 >= L)
        continue;
      int curl = lcp[i][j + 1], pos;
      if (curl >= j - i + 1 || x[i + curl] < x[j + 1 + curl]) {
        pos = j + 1 + (j - i + 1) - 1;
      } else
        pos = j + 1 + (j - i + 1) - 1 + 1;
      if (j + 1 < L && pos < L)
        dp[j + 1][pos] = min(dp[j + 1][pos], dp[i][j] + 1);
    }
  }
  res = MAX;
  for (int i = 1; i <= L; i++) {
    if (dp[L - i][L - 1] == MAX) continue;
    if (i <= 18) {
      int cur = 0;
      for (int j = L - i; j <= L - 1; j++) {
        cur = cur * 2 + x[j] - '0';
      }
      res = min(res, dp[L - i][L - 1] + cur);
    } else {
      if (res != MAX) break;
      int cur = 0;
      for (int j = L - i; j <= L - 1; j++) {
        cur = cur * 2 + x[j] - '0';
        cur %= Mod;
      }
      res = dp[L - i][L - 1] + cur;
      res %= Mod;
      break;
    }
  }
  cout << res << endl;
  return 0;
}