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 INF = 1000000000;
char s[5005];
int dp[5005][5005];
int f[5005][5005];
int len, clen;
const int MOD = 1000000007;
void add(int &cur, int pl) {
  cur += pl;
  if (cur >= MOD) cur -= MOD;
}
bool isbetter(int p1, int p2, int len) {
  int cur_len = f[p1][p2];
  if (cur_len >= len) return true;
  if (s[p1 + cur_len] > s[p2 + cur_len]) return false;
  return true;
}
int main() {
  scanf("%s", s);
  len = strlen(s);
  for (int i = len - 1; i >= 0; --i) {
    for (int j = len - 1; j >= 0; --j) {
      f[i][j] = 0;
      if (s[i] == s[j]) {
        f[i][j] = 1 + f[i + 1][j + 1];
      }
    }
  }
  dp[0][0] = 1;
  for (int i = 0; i < len; ++i) {
    if (s[i] == '0') {
      continue;
    }
    int cur = 0;
    for (int j = 0; j < len; ++j) {
      add(cur, dp[i][j]);
      dp[i][j] = cur;
    }
    for (int j = i; j < len; ++j) {
      clen = j - i + 1;
      if (j + clen > len) continue;
      if (isbetter(i, j + 1, clen)) {
        add(dp[j + 1][j + clen], dp[i][j]);
      } else {
        add(dp[j + 1][j + clen + 1], dp[i][j]);
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < len; ++i) {
    if (s[i] != '0') add(ans, dp[i][len - 1]);
  }
  printf("%d\n", ans);
  for (int i = 0; i < len; ++i)
    for (int j = 0; j < len; ++j) dp[i][j] = INF;
  dp[0][0] = 1;
  for (int i = 0; i < len; ++i) {
    if (s[i] == '0') {
      continue;
    }
    int cur = INF;
    for (int j = 0; j < len; ++j) {
      cur = min(cur, dp[i][j]);
      dp[i][j] = cur;
    }
    for (int j = i; j < len; ++j) {
      clen = j - i + 1;
      if (j + clen > len) continue;
      if (isbetter(i, j + 1, clen)) {
        dp[j + 1][j + clen] = min(dp[j + 1][j + clen], dp[i][j] + 1);
      } else {
        dp[j + 1][j + clen + 1] = min(dp[j + 1][j + clen + 1], dp[i][j] + 1);
      }
    }
  }
  ans = -1;
  for (int i = len - 1; i >= 0; --i) {
    if (s[i] == '0' || dp[i][len - 1] == INF) continue;
    if (ans == -1) {
      int res = 0;
      for (int j = i; j < len; ++j) {
        res = res * 2 + (s[j] - '0');
        res %= MOD;
      }
      res += dp[i][len - 1];
      res %= MOD;
      ans = res;
    } else {
      if (len - i > 20) continue;
      int res = 0;
      for (int j = i; j < len; ++j) {
        res = res * 2 + s[j] - '0';
        res %= MOD;
      }
      res += dp[i][len - 1];
      res %= MOD;
      if (ans > res) ans = res;
    }
  }
  printf("%d\n", ans);
  return 0;
}