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>
#pragma comment(linker, "/STACK:36777216")
using namespace std;
const int N = 5005;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
char ch[N];
int f[N][N], g[N][N], lcp[N][N], n;
inline int Gao(int i, int j) {
  if (ch[j + 1] == '0') return -1;
  int d = j - i + 1;
  if (n - j < d) return -1;
  int t = lcp[i][j + 1];
  if (t >= d) return j + d;
  if (ch[i + t] < ch[j + 1 + t]) return j + d;
  if (n - j < d + 1) return -1;
  return j + d + 1;
}
int main() {
  scanf(" %s", ch + 1);
  n = strlen(ch + 1);
  for (int i = n; i >= 1; i--)
    for (int j = n; j >= 1; j--) {
      if (ch[i] != ch[j])
        lcp[i][j] = 0;
      else
        lcp[i][j] = lcp[i + 1][j + 1] + 1;
    }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) g[i][j] = INF;
  f[1][1] = g[1][1] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      if (g[i][j] == INF) continue;
      g[i][j + 1] = min(g[i][j + 1], g[i][j]);
      f[i][j + 1] = (f[i][j + 1] + f[i][j]) % MOD;
      int t = Gao(i, j);
      if (t != -1) {
        g[j + 1][t] = min(g[j + 1][t], g[i][j] + 1);
        f[j + 1][t] = (f[j + 1][t] + f[i][j]) % MOD;
      }
    }
  int ans1 = 0, ans2 = INF, t = 0, q = 1;
  for (int i = 1; i <= n; i++) ans1 = (ans1 + f[i][n]) % MOD;
  for (int i = n; i >= 1 && i >= n - 20; i--) {
    t = t + (ch[i] == '1' ? q : 0), t %= MOD;
    if (g[i][n] != INF) {
      ans2 = min(ans2, g[i][n] + t);
    }
    q = q * 2, q %= MOD;
  }
  if (ans2 == INF) {
    for (int i = n - 21; i >= 1; i--) {
      t = t + (ch[i] == '1' ? q : 0), t %= MOD;
      t %= MOD;
      if (g[i][n] != INF) {
        ans2 = t + g[i][n];
        break;
      }
      q = q * 2, q %= MOD;
    }
  }
  printf("%d\n%d\n", ans1 % MOD, ans2 % MOD);
}