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 maxn = 5e3 + 7;
const int mod = 1e9 + 7;
const int INF = 1e9 + 7;
const int mlog = 20;
const int SQ = 400;
string s;
int n;
bool mark[maxn][maxn];
int prt[maxn][maxn], cnt[maxn][maxn];
inline long long calc(int i) {
  long long res = 0;
  for (; i < n; i++) {
    res *= 2;
    if (s[i] == '1') res++;
    res %= mod;
  }
  return res;
}
void prepL() {
  for (int l = 1; l * 2 <= n; l++) {
    int pos = n - 2 * l;
    while (pos < n - l && s[pos] == s[pos + l]) pos++;
    int lst = pos;
    if (pos == n - l || s[pos] == '0')
      mark[n - 2 * l][l] = 1;
    else
      mark[n - 2 * l][l] = 0;
    for (int i = n - 2 * l - 1; i >= 0; i--) {
      if (s[i] != s[i + l]) {
        lst = i;
        if (s[i] == '0') {
          mark[i][l] = 1;
          continue;
        } else {
          mark[i][l] = 0;
          continue;
        }
      }
      if (lst >= i + l) {
        mark[i][l] = 1;
        continue;
      }
      mark[i][l] = mark[i + 1][l];
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(), cout.tie();
  ;
  cin >> s;
  n = s.size();
  prepL();
  for (int i = 0; i < maxn; i++)
    for (int j = 0; j < maxn; j++) prt[i][j] = mod;
  prt[0][0] = cnt[0][0] = 1;
  for (int j = 0; j < n; j++) {
    if (s[j] == '0') continue;
    for (int i = j; i < n; i++) {
      if (i == n - 1) continue;
      prt[i + 1][j] = min(prt[i][j], prt[i + 1][j]);
      cnt[i + 1][j] = (cnt[i + 1][j] + cnt[i][j]) % mod;
      if (s[i + 1] == '0') continue;
      int len = i - j + 1;
      if (i + len > n - 1) continue;
      if (mark[j][len]) {
        prt[i + len][i + 1] = min(prt[i + len][i + 1], prt[i][j] + 1);
        cnt[i + len][i + 1] = (cnt[i + len][i + 1] + cnt[i][j]) % mod;
      } else if (i + len < n - 1) {
        prt[i + len + 1][i + 1] = min(prt[i + len + 1][i + 1], prt[i][j] + 1);
        cnt[i + len + 1][i + 1] = (cnt[i + len + 1][i + 1] + cnt[i][j]) % mod;
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) ans = (ans + cnt[n - 1][i]) % mod;
  cout << ans << "\n";
  ans = mod;
  for (int i = n - 1; i >= max(0, n - 15); i--) {
    if (prt[n - 1][i] == mod) continue;
    ans = min(ans, prt[n - 1][i] + calc(i));
  }
  if (ans < mod) return cout << ans << "\n", 0;
  for (int i = n - 16; i >= 0; i--)
    if (prt[n - 1][i] < mod)
      return cout << ((calc(i) + prt[n - 1][i])) % mod << "\n", 0;
  return 0;
}