#include <bits/stdc++.h>
using namespace std;
int ans1, ans2;
int N, M, flag;
int dis[5005][5005];
int sum[5005][5005];
int dp[5005][5005];
int pw[5005];
char ss[5005];
int main() {
  int i, j, t, tmp;
  scanf("%s", ss + 1);
  N = strlen(ss + 1);
  for (i = N; i >= 1; i--)
    for (j = N; j > i; j--)
      dis[i][j] = (ss[i] == ss[j] ? dis[i + 1][j + 1] + 1 : 0);
  dp[0][0] = 1;
  for (i = 1; i <= N; i++) {
    for (j = i - 1; j >= 0; j--)
      sum[i - 1][j] = (sum[i - 1][j + 1] + dp[j][i - 1]) % 1000000007;
    for (j = i; j <= N; j++)
      if (ss[i] == '1' && (j == N || ss[j + 1] == '1')) {
        dp[i][j] = sum[i - 1][max(0, 2 * i - j)];
        t = 2 * i - j - 1;
        if (i == 1 && t == 0) dp[i][j] = (dp[i][j] + dp[t][i - 1]) % 1000000007;
        if (t >= 1) {
          tmp = dis[t][i];
          if (tmp >= j - i + 1 || ss[t + tmp] < ss[i + tmp])
            dp[i][j] = (dp[i][j] + dp[t][i - 1]) % 1000000007;
        }
      }
  }
  for (i = 1; i <= N; i++) ans1 = (ans1 + dp[i][N]) % 1000000007;
  memset(dp, 62, sizeof(dp));
  memset(sum, 62, sizeof(sum));
  dp[0][0] = 0;
  for (i = 1; i <= N; i++) {
    for (j = i - 1; j >= 0; j--)
      sum[i - 1][j] = min(sum[i - 1][j + 1], dp[j][i - 1]);
    for (j = i; j <= N; j++)
      if (ss[i] == '1' && (j == N || ss[j + 1] == '1')) {
        dp[i][j] = sum[i - 1][max(0, 2 * i - j)] + 1;
        t = 2 * i - j - 1;
        if (i == 1 && t == 0) dp[i][j] = min(dp[i][j], dp[t][i - 1] + 1);
        if (t >= 1) {
          tmp = dis[t][i];
          if (tmp >= j - i + 1 || ss[t + tmp] < ss[i + tmp])
            dp[i][j] = min(dp[i][j], dp[t][i - 1] + 1);
        }
      }
  }
  for (i = 1, pw[0] = 1; i <= N; i++) pw[i] = pw[i - 1] * 2 % 1000000007;
  flag = 0;
  for (i = N, tmp = 0; i >= 1; i--) {
    tmp = (tmp + pw[N - i] * (ss[i] - '0')) % 1000000007;
    if (dp[i][N] < dp[N + 1][N + 1]) {
      if (flag == 0)
        flag = 1, ans2 = (tmp + dp[i][N]) % 1000000007;
      else if (N - i <= 20)
        ans2 = min(ans2, tmp + dp[i][N]);
    }
  }
  printf("%d\n%d\n", ans1, ans2);
  return 0;
}
