#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;
  for (int i = n - 1; i >= 0; i--) {
    num = num + exp * a[i];
    if (num >= mod) {
      if (ans2 < inf) break;
      if (s[i][n] < inf) {
        ans2 = (num % mod + s[i][n]) % mod;
        break;
      }
      num %= mod;
    } else if (s[i][n] < inf)
      ans2 = ((ans2) < (num + s[i][n]) ? (ans2) : (num + s[i][n]));
    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]));
}
