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 lcp[5005][5005];
unsigned long long hs[5005];
unsigned long long p[5005];
int c[5005][5005];
unsigned long long geths(int l, int r) {
  r++;
  return hs[r] - hs[l] * p[r - l];
}
inline bool cmp(int l, int r, int ll, int rr) {
  if (r - l != rr - ll) return r - l > rr - ll;
  int g = lcp[l][ll];
  if (g >= r - l + 1) return false;
  return s[l + g] > s[ll + g];
}
int f[5005];
inline int check(int l, int r) {
  int cnt = 1;
  while (l != 0) {
    cnt++;
    int len = r - l + 1;
    int ll = l - len, rr = l - 1;
    if (ll < 0) return cnt;
    if (s[ll] == '0' || cmp(ll, rr, l, r)) {
      int flag = 0;
      for (int i = ll + 1; i <= rr; ++i)
        if (s[i] != '0') {
          ll = i;
          flag = 1;
          break;
        }
      if (flag == 0) return -1;
    }
    l = ll;
    r = rr;
  }
  return cnt;
}
inline int cal(int l, int r) {
  int x = 0;
  for (int i = l; i <= r; ++i) x = (x * 2 + s[i] - '0') % 1000000007;
  return x;
}
int dp[5005][5005];
inline int add(int x) {
  if (x >= 1000000007) x -= 1000000007;
  return x;
}
int u[5005];
int main() {
  scanf(" %s", s);
  int n = strlen(s);
  hs[0] = 1;
  p[0] = 1;
  for (int i = 1; i <= n; ++i) p[i] = p[i - 1] * 31;
  for (int i = 1; i <= n; ++i) hs[i] = hs[i - 1] * 31 + s[i - 1] - '0' + 1;
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j) {
      if (s[i] != s[j]) {
        lcp[i][j] = lcp[j][i] = 0;
      } else {
        int l = 1, r = n - j;
        while (r - l > 1) {
          int mid = (l + r) >> 1;
          if (geths(i, i + mid - 1) == geths(j, j + mid - 1))
            l = mid;
          else
            r = mid;
        }
        if (geths(i, i + r - 1) == geths(j, j + r - 1)) l = r;
        lcp[i][j] = lcp[j][i] = l;
      }
    }
  memset(c, -1, sizeof(c));
  c[0][0] = 1;
  dp[0][0] = 1;
  for (int j = 0; j < n; ++j) {
    for (int i = 0; i <= j; ++i) {
      if (s[i] == '0') continue;
      if (c[i][j] == -1) continue;
      dp[i][j + 1] = add(dp[i][j + 1] + dp[i][j]);
      if (c[i][j + 1] == -1 || c[i][j + 1] > c[i][j]) c[i][j + 1] = c[i][j];
      int k = j + j - i + 1;
      if (k >= n) continue;
      if (!cmp(i, j, j + 1, k)) {
        dp[j + 1][k] = add(dp[j + 1][k] + dp[i][j]);
        if (c[j + 1][k] == -1 || c[j + 1][k] > c[i][j] + 1)
          c[j + 1][k] = c[i][j] + 1;
      } else if (s[j + 1] != '0') {
        dp[j + 1][k + 1] = add(dp[j + 1][k + 1] + dp[i][j]);
        if (c[j + 1][k + 1] == -1 || c[j + 1][k + 1] > c[i][j] + 1)
          c[j + 1][k + 1] = c[i][j] + 1;
      }
    }
  }
  int ans = -1;
  for (int i = 1; i <= n; ++i) {
    if (ans != -1 && i > 20) break;
    if (dp[n - i][n - 1] == 0) continue;
    int x = cal(n - i, n - 1) + c[n - i][n - 1];
    if (ans == -1 || x < ans) ans = x;
  }
  int res = 0;
  for (int j = 0; j < n; ++j) res = add(res + dp[j][n - 1]);
  printf("%d\n", res);
  printf("%d\n", ans % 1000000007);
}