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>
const int inf = 0x7F7F7F7F;
const int mod = 1000000007;
const int size = 5005;
int n;
int a[size];
int sa[size], rank[size], height[size];
int f[size][15];
int s[size][size], d[size][size];
inline int lg(int);
inline void swap(int*&, int*&);
inline void swap(int&, int&);
inline int getstr(int*);
inline void buildSA();
inline void calcHeight();
inline void prepare();
inline int LCP(int, int);
int main() {
  long long exp;
  long long ans1, ans2;
  int l;
  register int i, j, k;
  n = getstr(a);
  if (n == 1) {
    printf("1\n%d\n", a[0] == 0 ? 1 : 2);
    return 0;
  }
  buildSA();
  calcHeight();
  prepare();
  memset(s, 0x7F, sizeof s);
  s[0][1] = 1;
  d[0][1] = 1;
  for (i = 0; i < n; i++)
    for (j = i + 1; j <= n; j++) {
      s[i][j] = ((s[i][j]) < (s[i][j - 1]) ? (s[i][j]) : (s[i][j - 1]));
      d[i][j] = (d[i][j] + d[i][j - 1]) % mod;
      if (a[j] < 1) continue;
      l = j - i;
      k = LCP(i, j);
      if (k >= l || a[i + k] < a[j + k])
        k = j + l;
      else
        k = j + l + 1;
      if (k <= n) {
        s[j][k] = ((s[j][k]) < (s[i][j] + 1) ? (s[j][k]) : (s[i][j] + 1));
        d[j][k] = (d[j][k] + d[i][j]) % mod;
      }
    }
  ans1 = 0;
  for (int i = 0; i < n; i++) ans1 = (ans1 + d[i][n]) % mod;
  printf("%I64d\n", ans1);
  exp = 1;
  ans2 = inf;
  long long num = 0;
  bool get = false;
  for (int i = n - 1; i >= 0; i--) {
    num = num + exp * a[i];
    if (num >= mod) {
      if (ans2 < inf) break;
      num %= mod;
      get = true;
    }
    if (s[i][n] <= n) {
      ans2 = ((ans2) < (num + s[i][n]) ? (ans2) : (num + s[i][n]));
      if (get) break;
    }
    exp = (exp << 1) % mod;
  }
  printf("%I64d\n", ans2 % mod);
  return 0;
}
inline int lg(int x) { return 31 - __builtin_clz(x); }
inline void swap(int*& x, int*& y) {
  int* t = x;
  x = y;
  y = t;
}
inline void swap(int& x, int& y) {
  int t = x;
  x = y;
  y = t;
}
inline int getstr(int* s) {
  register int len = 0;
  register char ch;
  do ch = getchar();
  while (ch < '0' || ch > '1');
  do s[len++] = ch - '0', ch = getchar();
  while (ch >= '0' && ch <= '1');
  return len;
}
inline void buildSA() {
  static int t[2][size];
  static int c[size];
  int *x = t[0], *y = t[1];
  int m = 2;
  for (int i = 0; i < m; i++) c[i] = 0;
  for (int i = 0; i < n; i++) c[x[i] = a[i]]++;
  for (int i = 1; i < m; i++) c[i] += c[i - 1];
  for (int i = n - 1; i >= 0; i--) sa[--c[x[i]]] = i;
  for (int j = 0, k = 1; j < n && k < n; m = j, k <<= 1) {
    j = 0;
    for (int i = n - k; i < n; i++) y[j++] = i;
    for (int i = 0; i < n; i++)
      if (sa[i] >= k) y[j++] = sa[i] - k;
    for (int i = 0; i < m; i++) c[i] = 0;
    for (int i = 0; i < n; i++) c[x[y[i]]]++;
    for (int i = 1; i < m; i++) c[i] += c[i - 1];
    for (int i = n - 1; i >= 0; i--) sa[--c[x[y[i]]]] = y[i];
    swap(x, y);
    j = 1;
    x[sa[0]] = 0;
    for (int i = 1; i < n; i++)
      x[sa[i]] = y[sa[i - 1]] == y[sa[i]] && y[sa[i - 1] + k] == y[sa[i] + k]
                     ? j - 1
                     : j++;
  }
}
inline void calcHeight() {
  int l = 0;
  for (int i = 0; i < n; i++) rank[sa[i]] = i;
  for (int i = 0; i < n; i++) {
    int j = sa[rank[i] - 1];
    for (l = l ? l - 1 : 0; a[i + l] == a[j + l]; l++)
      ;
    height[rank[i]] = l;
  }
}
inline void prepare() {
  for (int i = 1; i < n; i++) f[i][0] = height[i];
  for (int j = 1; (1 << j) < n; j++)
    for (int i = 1; i + (1 << j) - 1 < n; i++)
      f[i][j] = ((f[i][j - 1]) < (f[i + (1 << (j - 1))][j - 1])
                     ? (f[i][j - 1])
                     : (f[i + (1 << (j - 1))][j - 1]));
}
inline int LCP(int x, int y) {
  x = rank[x];
  y = rank[y];
  if (x > y) swap(x, y);
  x++;
  int l = lg(y - x + 1);
  return ((f[x][l]) < (f[y - (1 << l) + 1][l]) ? (f[x][l])
                                               : (f[y - (1 << l) + 1][l]));
}