#include <bits/stdc++.h>
using namespace std;
const int kMod = 1000000007;
const int kInf = 0x3f3f3f3f;
const int kSeed = 99991;
char seq[5111];
unsigned long long h[5111], p[5111];
int n;
int f[5111];
int s[5111][5111];
int g[5111];
int q[5111][5111];
inline unsigned long long calc(int l, int r) {
  unsigned long long res = h[r] - h[l - 1] * p[r - l + 1];
  return res;
}
int cmp(int l, int r, int k) {
  int lb = 0, rb = k + 1;
  while (lb + 1 < rb) {
    int mid = (lb + rb) >> 1;
    if (calc(l, l + mid - 1) == calc(r, r + mid - 1)) {
      lb = mid;
    } else {
      rb = mid;
    }
  }
  if (lb == k) return 0;
  if (seq[l + lb] < seq[r + lb]) {
    return -1;
  } else {
    return 1;
  }
}
int value(int l, int r) {
  int res = 0;
  for (int i = l; i <= r; ++i) {
    res = res << 1 | (seq[i] - '0');
    res %= kMod;
  }
  return res;
}
int main() {
  scanf("%s", seq + 1);
  n = strlen(seq + 1);
  p[0] = 1;
  for (int i = 1; i <= n; ++i) {
    h[i] = h[i - 1] * kSeed + seq[i];
    p[i] = p[i - 1] * kSeed;
  }
  for (int i = 1; i <= n; ++i) {
    f[i] = 1;
    g[i] = 1;
    for (int j = i - 1; j >= 1; --j) {
      f[j] = 0;
      g[j] = kInf;
      if (seq[i - j + 1] == '0') continue;
      if (i - j < j) {
        {
          (f[j]) += (s[i - j][i - j]);
          if ((f[j]) >= kMod) {
            (f[j]) -= kMod;
          }
        };
        g[j] = q[i - j][i - j] + 1;
      } else {
        if (cmp(i - j - j + 1, i - j + 1, j) <= 0) {
          {
            (f[j]) += (s[i - j][j]);
            if ((f[j]) >= kMod) {
              (f[j]) -= kMod;
            }
          };
          g[j] = q[i - j][j] + 1;
        } else {
          {
            (f[j]) += (s[i - j][j - 1]);
            if ((f[j]) >= kMod) {
              (f[j]) -= kMod;
            }
          };
          g[j] = q[i - j][j - 1] + 1;
        }
      }
    }
    q[i][0] = kInf;
    for (int j = 1; j <= i; ++j) {
      s[i][j] = s[i][j - 1];
      {
        (s[i][j]) += (f[j]);
        if ((s[i][j]) >= kMod) {
          (s[i][j]) -= kMod;
        }
      };
      q[i][j] = min(q[i][j - 1], g[j]);
    }
  }
  printf("%d\n", s[n][n]);
  int res = kInf;
  for (int j = 1; j <= n; ++j)
    if (g[j] < kInf) {
      if (j < 20) {
        res = min(res, g[j] + value(n - j + 1, n));
      } else {
        if (res == kInf) {
          res = g[j];
          {
            (res) += (value(n - j + 1, n));
            if ((res) >= kMod) {
              (res) -= kMod;
            }
          };
        }
        break;
      }
    }
  printf("%d\n", res);
  return 0;
}
