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;
template <class T>
inline T sqr(T x) {
  return x * x;
}
const int INF = 0x3fffffff;
const double PI = acos(-1.0);
using namespace std;
char s[5005];
int dp[5005][5005];
int mi[5005][5005];
int lcp[5005][5005];
void Add(int &ans, int v) {
  ans += v;
  if (ans >= 1000000007) ans -= 1000000007;
}
void Min(int &ans, int v) {
  if (ans > v) ans = v;
}
bool large(int i, int j, int len) {
  if (lcp[i][j] >= len)
    return 1;
  else
    return j == 0 || s[i + lcp[i][j] - 1] > s[j + lcp[i][j] - 1];
}
int solve(int i) {
  int ans = 0;
  for (int j = i - 1; s[j]; j++) {
    Add(ans, ans + s[j] - '0');
  }
  return ans;
}
int main(void) {
  memset(mi, 0x3f, sizeof(mi));
  scanf("%s", s);
  int n = strlen(s);
  dp[1][0] = 1;
  mi[1][0] = 0;
  for (int i = n; i >= 1; i--) {
    for (int j = n; j >= 0; j--) {
      if (s[i - 1] == s[j - 1])
        lcp[i][j] = lcp[i + 1][j + 1] + 1;
      else
        lcp[i][j] = 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < i; j++) {
      if (j) {
        Add(dp[i + 1][j], dp[i][j]);
        Min(mi[i + 1][j], mi[i][j]);
      }
      int len = i - j;
      if (s[i - 1] == '1') {
        if (large(i, j, len)) {
          if (i + len <= n + 1) {
            Add(dp[i + len][i], dp[i][j]);
            Min(mi[i + len][i], mi[i][j] + 1);
          }
        } else {
          len++;
          if (i + len <= n + 1) {
            Add(dp[i + len][i], dp[i][j]);
            Min(mi[i + len][i], mi[i][j] + 1);
          }
        }
      }
    }
  }
  int ans = 0;
  int ret = INF, ret1 = INF;
  for (int i = 1; i <= n; i++) {
    if (s[i - 1] == '1') {
      Add(ans, dp[n + 1][i]);
      if (mi[n + 1][i] != 0x3f3f3f3f && i + 25 >= n) {
        ret = min(ret, (solve(i) + mi[n + 1][i]) % 1000000007);
      }
      if (i + 25 < n && mi[n + 1][i] != 0x3f3f3f3f) {
        ret1 = (solve(i) + mi[n + 1][i]) % 1000000007;
      }
    }
  }
  if (ret == INF) ret = ret1;
  printf("%d\n", ans);
  printf("%d\n", ret);
  return 0;
}