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;
struct node {
  int son[2];
  int ends;
};
struct trie {
  vector<node> V;
  node n0;
  trie() {
    n0.son[0] = n0.son[1] = n0.ends = -1;
    V.reserve(15000000);
    V.resize(1, n0);
  }
  void put(string s, int x) {
    int L = s.length(), akt = 0;
    for (int i = 0; i < L; i++) {
      if (V[akt].son[s[i] - '0'] == -1) {
        V[akt].son[s[i] - '0'] = V.size();
        V.push_back(n0);
      }
      akt = V[akt].son[s[i] - '0'];
    }
    V[akt].ends = x;
  }
  void fillStd(int R, vector<int> &v) {
    if (V[R].ends >= 0) v.push_back(V[R].ends);
    for (int i = 0; i < 2; i++)
      if (V[R].son[i] >= 0) fillStd(V[R].son[i], v);
  }
};
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  int N = s.length();
  int mod = 1000000007;
  trie T;
  for (int i = 0; i < N; i++) T.put(s.substr(i, N - i), i);
  vector<int> std(1, N);
  T.fillStd(0, std);
  vector<int> SA(N + 1);
  for (int i = 0; i <= N; i++) SA[std[i]] = i;
  vector<vector<int> > LCP(N, vector<int>(N + 1, 0));
  for (int i = N - 1; i >= 0; i--)
    for (int j = i + 1; j < N; j++)
      if (s[i] == s[j]) LCP[i][j] = LCP[i + 1][j + 1] + 1;
  vector<vector<int> > P(N + 1, vector<int>(N + 1, 0));
  vector<vector<int> > S(N + 1, vector<int>(N + 1, N + 47));
  P[0][1] = S[0][1] = 1;
  for (int i = 0; i < N; i++)
    for (int j = i + 1; j < N; j++) {
      P[i][j + 1] = (P[i][j + 1] + P[i][j]) % mod;
      S[i][j + 1] = min(S[i][j + 1], S[i][j]);
      if (j + (j - i) <= N && s[j] == '1' &&
          (LCP[i][j] >= j - i || SA[i] < SA[j])) {
        P[j][j + (j - i)] = (P[j][j + (j - i)] + P[i][j]) % mod;
        S[j][j + (j - i)] = min(S[j][j + (j - i)], S[i][j] + 1);
      } else if (j + (j - i + 1) <= N && s[j] == '1') {
        P[j][j + (j - i) + 1] = (P[j][j + (j - i) + 1] + P[i][j]) % mod;
        S[j][j + (j - i) + 1] = min(S[j][j + (j - i) + 1], S[i][j] + 1);
      }
    }
  long long ans = 0;
  for (int i = 0; i < N; i++) ans = (ans + P[i][N]) % mod;
  cout << ans << "\n";
  long long ans2 = mod;
  for (int i = N - 1; i >= 0; i--)
    if (S[i][N] < N + 47) {
      long long a = 1, akt = S[i][N];
      for (int j = N - 1; j >= i; j--) {
        if (s[j] == '1') akt = (akt + a) % mod;
        a = (a * 2) % mod;
      }
      if (N - i >= 25) {
        if (ans2 != mod)
          cout << ans2 << "\n";
        else
          cout << akt << "\n";
        return 0;
      } else
        ans2 = min(ans2, akt);
    }
  cout << ans2 << "\n";
  return 0;
}