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[5005];
int dp[5005][5005], f[5005][5005], cnt[5005][5005];
int main() {
  int T, i, j, ca = 0, m, n, k;
  while (~scanf("%s", s + 1)) {
    n = strlen(s + 1);
    for (i = n; i > 1; i--)
      for (j = i; j <= n; j++) {
        if (i == j)
          dp[i][j] = 1;
        else {
          if (i + dp[i][j] < j) {
            if (s[i - 1] == s[j - 1])
              dp[i - 1][j - 1] = dp[i][j] + 1;
            else
              dp[i - 1][j - 1] = 0;
          }
        }
      }
    for (i = 0; i <= n; i++)
      for (j = 0; j <= n; j++) f[i][j] = 1000000007;
    cnt[1][1] = 1;
    f[1][1] = 1;
    for (j = 1; j < n; j++)
      for (i = 1; i <= j; i++) {
        (cnt[i][j + 1] += cnt[i][j]) %= 1000000007;
        f[i][j + 1] = min(f[i][j + 1], f[i][j]);
        if (s[j + 1] == '0') continue;
        int d = dp[i][j + 1];
        k = j - i + 1;
        if (d == k || s[i + d] <= s[j + 1 + d])
          ;
        else
          k++;
        if (j + k <= n) {
          int first = j + k;
          (cnt[j + 1][first] += cnt[i][j]) %= 1000000007;
          f[j + 1][first] = min(f[j + 1][first], f[i][j] + 1);
        }
      }
    int ans = 0;
    const long long INF = 1000000007 + 1000000;
    for (i = 1; i <= n; i++) {
      (ans += cnt[i][n]) %= 1000000007;
    }
    printf("%d\n", ans);
    long long best = INF, ep = 1, res = 0;
    bool big = 0;
    for (i = n; i >= 1; i--) {
      res += ep * (s[i] - '0');
      if (res >= INF) {
        if (best < INF) break;
        res -= 1000000007;
        big = 1;
      }
      if (f[i][n] <= n) {
        best = min(best, res + f[i][n]);
        if (big) break;
      }
      ep <<= 1;
      if (ep >= INF) big = 1;
      ep %= 1000000007;
    }
    printf("%d\n", best % 1000000007);
  }
  return 0;
}