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;
const int MOD = 1000000007;
char s[5001];
int slen;
int minprints[5001][5002];
int ways[5001][5002];
inline void update(int si, int sj, int ti, int tj, int extra) {
  if ((ways[ti][tj] += ways[si][sj]) >= MOD) ways[ti][tj] -= MOD;
  if (minprints[ti][tj] == -1 || minprints[si][sj] + extra < minprints[ti][tj])
    minprints[ti][tj] = minprints[si][sj] + extra;
}
int leneq[5001][5001];
bool islowerequal(int a, int b, int len) {
  int x = leneq[a][b];
  return x >= len ? true : s[a + x] < s[b + x];
}
void run() {
  scanf("%s", s);
  slen = strlen(s);
  memset(leneq, 0, sizeof(leneq));
  for (int i = slen - 1; i >= 0; --i)
    for (int j = slen - 1; j >= 0; --j)
      if (s[i] == s[j]) leneq[i][j] = 1 + leneq[i + 1][j + 1];
  memset(minprints, -1, sizeof(minprints));
  memset(ways, 0, sizeof(ways));
  ways[0][1] = 1;
  minprints[0][1] = 0;
  for (int i = (0); i < (slen); ++i)
    if (s[i] == '1')
      for (int j = (1); j <= (slen - i); ++j)
        if (minprints[i][j] != -1) {
          update(i, j, i, j + 1, 0);
          bool ok = i + 2 * j > slen || islowerequal(i, i + j, j);
          update(i, j, i + j, j + (ok ? 0 : 1), 1);
        }
  int totways = 0;
  for (int j = (1); j <= (slen); ++j)
    if ((totways += ways[slen][j]) >= MOD) totways -= MOD;
  int totminlen = INT_MAX;
  for (int j = (1); j <= (slen); ++j)
    if (minprints[slen][j] != -1) {
      int curminlen = 0;
      for (int i = (0); i < (j); ++i)
        curminlen = (curminlen * 2 + s[slen - j + i] - '0') % MOD;
      curminlen = (curminlen + minprints[slen][j]) % MOD;
      if (curminlen < totminlen && (totminlen == INT_MAX || j <= 20))
        totminlen = curminlen;
    }
  printf("%d\n%d\n", totways, totminlen);
}
int main() {
  run();
  return 0;
}