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;
int way[5005][5005];
int dp[5005][5005];
int sa[5005], rnk[5005];
int lcp[5005], mn[5005];
pair<pair<int, int>, int> pos[5005];
char str[5005];
int main() {
  scanf("%s", &str);
  int n = strlen(str);
  for (int i = n; i >= 1; i--) str[i] = str[i - 1];
  str[0] = '0';
  n++;
  for (int i = 0; i < n; i++) rnk[i] = str[i] - '0';
  for (int k = 1; k <= n; k <<= 1) {
    for (int i = 0; i < n; i++) {
      pos[i] = pair<pair<int, int>, int>(
          pair<int, int>(rnk[i], (i + k < n ? rnk[i + k] : -1)), i);
    }
    sort(pos, pos + n);
    for (int i = 0; i < n;) {
      int s = i;
      for (; i < n && pos[i].first == pos[s].first; i++) {
        rnk[pos[i].second] = s;
      }
    }
  }
  for (int i = 0; i < n; i++) sa[rnk[i]] = i;
  int H = 0;
  for (int i = 0; i < n; i++) {
    if (H > 0) H--;
    if (rnk[i] == n - 1) continue;
    int tg = sa[rnk[i] + 1];
    while (tg + H < n && i + H < n && str[tg + H] == str[i + H]) H++;
    lcp[rnk[i]] = H;
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      dp[i][j] = 2 * n;
      way[i][j] = 0;
    }
  }
  dp[0][1] = 0;
  way[0][1] = 1;
  for (int i = 0; i < n - 1; i++) {
    if (str[i + 1] == '0') continue;
    int M = 5005;
    for (int j = rnk[i + 1] + 1; j < n; j++) {
      M = min(M, lcp[j - 1]);
      mn[sa[j]] = M;
    }
    M = 5005;
    for (int j = rnk[i + 1] - 1; j >= 0; j--) {
      M = min(M, lcp[j]);
      mn[sa[j]] = M;
    }
    M = 5005;
    int cnt = 0;
    for (int j = i + 1; j < n; j++) {
      int len = j - i;
      if (i - len + 1 >= 0 &&
          (mn[i - len + 1] >= len || (rnk[i - len + 1] < rnk[i + 1]))) {
        if (M > dp[i][len] + 1) {
          M = dp[i][len] + 1;
        }
        cnt += way[i][len];
        if (cnt >= 1000000007) cnt -= 1000000007;
      }
      if (dp[j][len] > M) {
        dp[j][len] = M;
      }
      way[j][len] += cnt;
      if (way[j][len] >= 1000000007) way[j][len] -= 1000000007;
      if (i - len + 1 >= 0 && mn[i - len + 1] < len &&
          rnk[i - len + 1] > rnk[i + 1]) {
        if (M > dp[i][len] + 1) {
          M = dp[i][len] + 1;
        }
        cnt += way[i][len];
        if (cnt >= 1000000007) cnt -= 1000000007;
      }
    }
  }
  int m = 1000000000;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    cnt += way[n - 1][i];
    if (cnt >= 1000000007) cnt -= 1000000007;
    if (dp[n - 1][i] < n) {
      if (i <= 20) {
        int t = 1, now = dp[n - 1][i];
        for (int j = 0; j < i; j++) {
          int p = n - j - 1;
          if (str[p] == '1') now += t;
          t <<= 1;
        }
        if (m > now) {
          m = now;
        }
      } else {
        if (m == 1000000000) {
          int t = 1, now = dp[n - 1][i];
          for (int j = 0; j < i; j++) {
            int p = n - j - 1;
            if (str[p] == '1') {
              now += t;
              if (now >= 1000000007) now -= 1000000007;
            }
            t <<= 1;
            if (t >= 1000000007) t -= 1000000007;
          }
          m = now;
        }
      }
    }
  }
  printf("%d\n%d\n", cnt, m);
  return 0;
}