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;
char s[5100];
int same[5001][5001], f[5001][5001], c[5001][5001];
void add(int& c, const int& a, const int& b) {
  c = a + b;
  if (c >= 1000000007) c -= 1000000007;
}
int bigger(const int& x, const int& y, const int& k) {
  if (y <= 0) return 0;
  int len = same[y][x];
  if (len >= k) return 1;
  return s[x + len] >= s[y + len];
}
int main() {
  while (scanf("%s", s + 1) != EOF) {
    int n = strlen(s + 1);
    for (int i = n; i >= 1; --i)
      for (int j = i; j <= n; ++j)
        if (s[i] == s[j])
          same[i][j] = same[i + 1][j + 1] + 1;
        else
          same[i][j] = 0;
    for (int i = 1; i <= n; ++i) f[1][i] = 1;
    c[1][1] = f[1][1];
    for (int i = 2; i <= n; ++i) {
      for (int j = i; j > 1; --j)
        if (s[j] == '1') {
          add(f[j][i], f[j][i], c[j - 1][min(i - j, j - 1)]);
          if (bigger(j, j - 1 - (i - j), i - j + 1)) {
            add(f[j][i], f[j][i], f[j - 1 - (i - j)][j - 1]);
          }
        }
      for (int j = i; j >= 1; --j) add(c[i][i - j + 1], c[i][i - j], f[j][i]);
    }
    int ans1 = 0;
    for (int i = 1; i <= n; ++i) add(ans1, ans1, f[i][n]);
    for (int i = 0; i <= n; ++i)
      for (int j = i; j <= n; ++j) f[i][j] = 0x3fffffff;
    for (int i = 1; i <= n; ++i) f[1][i] = 1;
    for (int i = 0; i <= n; ++i)
      for (int j = 0; j <= n; ++j) c[i][j] = 0x3fffffff;
    c[1][1] = 1;
    for (int i = 2; i <= n; ++i) {
      for (int j = i; j > 1; --j)
        if (s[j] == '1') {
          f[j][i] = min(f[j][i], c[j - 1][min(i - j, j - 1)] + 1);
          if (bigger(j, j - 1 - (i - j), i - j + 1))
            f[j][i] = min(f[j][i], f[j - 1 - (i - j)][j - 1] + 1);
        }
      for (int j = i; j >= 1; --j) c[i][i - j + 1] = min(c[i][i - j], f[j][i]);
    }
    int ans2 = 0x3fffffff, x;
    for (int i = n; i >= 1; --i)
      if (f[i][n] < 0x3fffffff) {
        if (n - i > 20) break;
        x = 0;
        for (int j = i; j <= n; ++j) x = (x << 1) + s[j] - '0';
        ans2 = min(ans2, x + f[i][n]);
      }
    if (ans2 == 0x3fffffff)
      for (int i = n - 20; i >= 1; --i)
        if (f[i][n] < 0x3fffffff) {
          x = 0;
          for (int j = i; j <= n; ++j) {
            x = (x << 1) + s[j] - '0';
            if (x >= 1000000007) x -= 1000000007;
          }
          ans2 = (x + f[i][n]) % 1000000007;
          break;
        }
    printf("%d\n%d\n", ans1, ans2 % 1000000007);
  }
}