#include <bits/stdc++.h>
using namespace std;
char s[5100];
int lcp[5005][5005];
unsigned long long hs[5005];
unsigned long long p[5005];
int c[5005][5005];
unsigned long long geths(int l, int r) {
  r++;
  return hs[r] - hs[l] * p[r - l];
}
inline bool cmp(int l, int r, int ll, int rr) {
  if (r - l != rr - ll) return r - l > rr - ll;
  int g = lcp[l][ll];
  if (g >= r - l + 1) return false;
  return s[l + g] > s[ll + g];
}
int f[5005];
inline int check(int l, int r) {
  int cnt = 1;
  while (l != 0) {
    cnt++;
    int len = r - l + 1;
    int ll = l - len, rr = l - 1;
    if (ll < 0) return cnt;
    if (s[ll] == '0' || cmp(ll, rr, l, r)) {
      int flag = 0;
      for (int i = ll + 1; i <= rr; ++i)
        if (s[i] != '0') {
          ll = i;
          flag = 1;
          break;
        }
      if (flag == 0) return -1;
    }
    l = ll;
    r = rr;
  }
  return cnt;
}
inline int cal(int l, int r) {
  int x = 0;
  for (int i = l; i <= r; ++i) x = (x * 2 + s[i] - '0') % 1000000007;
  return x;
}
int dp[5005][5005];
inline int add(int x) {
  if (x >= 1000000007) x -= 1000000007;
  return x;
}
int u[5005];
int main() {
  scanf(" %s", s);
  int n = strlen(s);
  hs[0] = 1;
  p[0] = 1;
  for (int i = 1; i <= n; ++i) p[i] = p[i - 1] * 31;
  for (int i = 1; i <= n; ++i) hs[i] = hs[i - 1] * 31 + s[i - 1] - '0' + 1;
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j) {
      if (s[i] != s[j]) {
        lcp[i][j] = lcp[j][i] = 0;
      } else {
        int l = 1, r = n - j;
        while (r - l > 1) {
          int mid = (l + r) >> 1;
          if (geths(i, i + mid - 1) == geths(j, j + mid - 1))
            l = mid;
          else
            r = mid;
        }
        if (geths(i, i + r - 1) == geths(j, j + r - 1)) l = r;
        lcp[i][j] = lcp[j][i] = l;
      }
    }
  memset(c, -1, sizeof(c));
  c[0][0] = 1;
  dp[0][0] = 1;
  for (int j = 0; j < n; ++j) {
    for (int i = 0; i <= j; ++i) {
      if (s[i] == '0') continue;
      if (c[i][j] == -1) continue;
      dp[i][j + 1] = add(dp[i][j + 1] + dp[i][j]);
      if (c[i][j + 1] == -1 || c[i][j + 1] > c[i][j]) c[i][j + 1] = c[i][j];
      int k = j + j - i + 1;
      if (k >= n) continue;
      if (!cmp(i, j, j + 1, k)) {
        dp[j + 1][k] = add(dp[j + 1][k] + dp[i][j]);
        if (c[j + 1][k] == -1 || c[j + 1][k] > c[i][j] + 1)
          c[j + 1][k] = c[i][j] + 1;
      } else if (s[j + 1] != '0') {
        dp[j + 1][k + 1] = add(dp[j + 1][k + 1] + dp[i][j]);
        if (c[j + 1][k + 1] == -1 || c[j + 1][k + 1] > c[i][j] + 1)
          c[j + 1][k + 1] = c[i][j] + 1;
      }
    }
  }
  int ans = -1;
  for (int i = 1; i <= n; ++i) {
    if (ans != -1 && i > 20) break;
    if (dp[n - i][n - 1] == 0) continue;
    int x = cal(n - i, n - 1) + c[n - i][n - 1];
    if (ans == -1 || x < ans) ans = x;
  }
  int res = 0;
  for (int j = 0; j < n; ++j) res = add(res + dp[j][n - 1]);
  printf("%d\n", res);
  printf("%d\n", ans % 1000000007);
}
