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 MAXS = 5000 + 5;
const int INF = 0x3f3f3f3f;
const int MOD = 1000000007;
int f[MAXS][MAXS];
int lc[MAXS][MAXS];
int l[MAXS][MAXS];
char s[MAXS];
int len;
void add(int &x, int y) { x = (x + y) % MOD; }
int main() {
  scanf("%s", s);
  len = strlen(s);
  for (int i = len; i > 0; --i) s[i] = s[i - 1];
  for (int i = len; i > 0; --i)
    for (int j = len; j > 0; --j)
      if (s[i] == s[j])
        lc[i][j] = lc[i + 1][j + 1] + 1;
      else
        lc[i][j] = 0;
  memset(f, 0, sizeof(f));
  f[1][1] = 1;
  for (int i = 1; i < len; ++i)
    for (int j = 1; j <= i; ++j) {
      add(f[i + 1][j + 1], f[i][j]);
      if (i + j > len) continue;
      int c = lc[i - j + 1][i + 1];
      if (c >= j || s[i - j + 1 + c] < s[i + 1 + c])
        add(f[i + j][j], f[i][j]);
      else if (s[i + 1] == '1')
        add(f[i + j + 1][j + 1], f[i][j]);
    }
  int sum = 0;
  for (int i = 1; i <= len; ++i) add(sum, f[len][i]);
  printf("%d\n", sum);
  memset(f, 0x3f, sizeof(f));
  f[1][1] = 1;
  for (int i = 1; i < len; ++i)
    for (int j = 1; j <= i; ++j) {
      f[i + 1][j + 1] = min(f[i + 1][j + 1], f[i][j]);
      if (i + j > len) continue;
      int c = lc[i - j + 1][i + 1];
      if (c >= j || s[i - j + 1 + c] < s[i + 1 + c])
        f[i + j][j] = min(f[i + j][j], f[i][j] + 1);
      else if (s[i + 1] == '1')
        f[i + j + 1][j + 1] = min(f[i + j + 1][j + 1], f[i][j] + 1);
    }
  int ans = INF;
  for (int i = len - 20 + 1; i <= len; ++i)
    if (f[len][len - i + 1] != INF) {
      int x = 0;
      for (int j = i; j <= len; ++j) x = (x * 2 + s[j] - '0') % MOD;
      add(x, f[len][len - i + 1]);
      if (ans > x) ans = x;
    }
  if (ans == INF) {
    for (int i = len - 20; i > 0; --i)
      if (f[len][len - i + 1] != INF) {
        int x = 0;
        for (int j = i; j <= len; ++j) x = (x * 2 + s[j] - '0') % MOD;
        add(x, f[len][len - i + 1]);
        if (ans > x) ans = x;
        break;
      }
  }
  printf("%d\n", ans);
  return 0;
}