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 = 5005;
const int inf = 1 << 29;
const int mod = 1000000007;
const double eps = 1e-8;
char ss[maxn];
int xi[maxn][13];
int lo(int x) {
  int tp = 1, res = 0;
  while (tp * 2 <= x) {
    tp <<= 1;
    res++;
  }
  return res;
}
struct suf {
  int s[maxn];
  int sa[maxn], t[maxn], t2[maxn], c[maxn], n, m;
  int rank[maxn], h[maxn];
  void init(int le) {
    n = le;
    m = 3;
    for (int i = 0; i < n; i++) s[i] = ss[i] - '0';
    s[n] = 0;
    build();
    rmq();
  }
  inline int lcp(int x, int y) {
    if (x > y) swap(x, y);
    return query(x + 1, y);
  }
  void rmq() {
    for (int i = 0; i < n; i++) xi[i][0] = h[i];
    for (int j = 1; j <= lo(n); j++)
      for (int i = 0; i + (1 << j) - 1 < n; i++)
        xi[i][j] = min(xi[i][j - 1], xi[i + (1 << (j - 1))][j - 1]);
  }
  int query(int x, int y) {
    int k = lo(y - x + 1);
    return min(xi[x][k], xi[y - (1 << k) + 1][k]);
  }
  void geth() {
    int i, j, k = 0;
    for (i = 0; i < n; i++) rank[sa[i]] = i;
    for (i = 0; i < n; i++) {
      if (k) k--;
      if (!rank[i]) continue;
      j = sa[rank[i] - 1];
      while (s[i + k] == s[j + k]) k++;
      h[rank[i]] = k;
    }
  }
  void build() {
    int i, *x = t, *y = t2;
    for (i = 0; i < m; i++) c[i] = 0;
    for (i = 0; i < n; i++) c[x[i] = s[i]]++;
    for (i = 1; i < m; i++) c[i] += c[i - 1];
    for (i = n - 1; i >= 0; i--) sa[--c[x[i]]] = i;
    for (int k = 1; k <= n; k <<= 1) {
      int p = 0;
      for (i = n - k; i < n; i++) y[p++] = i;
      for (i = 0; i < n; i++)
        if (sa[i] >= k) y[p++] = sa[i] - k;
      for (i = 0; i < m; i++) c[i] = 0;
      for (i = 0; i < n; i++) c[x[y[i]]]++;
      for (i = 1; i < m; i++) c[i] += c[i - 1];
      for (i = n - 1; i >= 0; i--) sa[--c[x[y[i]]]] = y[i];
      swap(x, y);
      p = 1, x[sa[0]] = 0;
      for (i = 1; i < n; i++) {
        if (y[sa[i]] != y[sa[i - 1]])
          x[sa[i]] = p++;
        else if (sa[i] < n - k && sa[i - 1] < n - k)
          x[sa[i]] = y[sa[i] + k] == y[sa[i - 1] + k] ? p - 1 : p++;
        else
          x[sa[i]] = p++;
      }
      if (p >= n) break;
      m = p;
    }
    geth();
  }
} st;
int dp[maxn][maxn], n;
int f(int l, int r) {
  int tp = r * 2 - l;
  if (tp > n) return -1;
  if (st.lcp(st.rank[l], st.rank[r]) >= r - l) return tp;
  if (st.rank[l] < st.rank[r]) return tp;
  return tp + 1 > n ? -1 : tp + 1;
}
int g(int x, int y) {
  if (!y) return x;
  return min(x, y);
}
int ff(int l, int r) {
  int res = 0, b = 1;
  for (int i = r - 1; i >= l; i--) {
    res = (res + (ss[i] - '0') * b) % mod;
    b = (b * 2) % mod;
  }
  return res;
}
int main() {
  scanf("%s", ss);
  n = strlen(ss);
  st.init(n);
  dp[0][1] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (!dp[i][j]) continue;
      dp[i][j + 1] = (dp[i][j + 1] + dp[i][j]) % mod;
      if (ss[j] == '1') {
        int p = f(i, j);
        if (p != -1) {
          dp[j][p] = (dp[j][p] + dp[i][j]) % mod;
        }
      }
    }
  }
  int r = 0;
  for (int i = 0; i < n; i++) r = (r + dp[i][n]) % mod;
  printf("%d\n", r);
  memset(dp, 0, sizeof(dp));
  dp[0][1] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (!dp[i][j]) continue;
      dp[i][j + 1] = g(dp[i][j], dp[i][j + 1]);
      if (ss[j] == '1') {
        int p = f(i, j);
        if (p != -1) {
          dp[j][p] = g(dp[i][j] + 1, dp[j][p]);
        }
      }
    }
  }
  int la = 1;
  for (int i = 0; i < n; i++) {
    if (dp[i][n]) {
      if (n - i >= 13)
        r = (ff(i, n) + dp[i][n]) % mod;
      else {
        if (la) {
          la = 0;
          r = ff(i, n) + dp[i][n];
        } else
          r = min(r, ff(i, n) + dp[i][n]);
      }
    }
  }
  printf("%d\n", r);
}