#include <bits/stdc++.h>
using namespace std;
int way[5005][5005];
int dp[5005][5005];
int sa[5005], rnk[5005];
int lcp[5005], mn[5005];
pair<pair<int, int>, int> pos[5005];
char str[5005];
int main() {
  scanf("%s", &str);
  int n = strlen(str);
  for (int i = n; i >= 1; i--) str[i] = str[i - 1];
  str[0] = '0';
  n++;
  for (int i = 0; i < n; i++) rnk[i] = str[i] - '0';
  for (int k = 1; k <= n; k <<= 1) {
    for (int i = 0; i < n; i++) {
      pos[i] = pair<pair<int, int>, int>(
          pair<int, int>(rnk[i], (i + k < n ? rnk[i + k] : -1)), i);
    }
    sort(pos, pos + n);
    for (int i = 0; i < n;) {
      int s = i;
      for (; i < n && pos[i].first == pos[s].first; i++) {
        rnk[pos[i].second] = s;
      }
    }
  }
  for (int i = 0; i < n; i++) sa[rnk[i]] = i;
  int H = 0;
  for (int i = 0; i < n; i++) {
    if (H > 0) H--;
    if (rnk[i] == n - 1) continue;
    int tg = sa[rnk[i] + 1];
    while (tg + H < n && i + H < n && str[tg + H] == str[i + H]) H++;
    lcp[rnk[i]] = H;
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      dp[i][j] = 2 * n;
      way[i][j] = 0;
    }
  }
  dp[0][1] = 0;
  way[0][1] = 1;
  for (int i = 0; i < n - 1; i++) {
    if (str[i + 1] == '0') continue;
    int M = 5005;
    for (int j = rnk[i + 1] + 1; j < n; j++) {
      M = min(M, lcp[j - 1]);
      mn[sa[j]] = M;
    }
    M = 5005;
    for (int j = rnk[i + 1] - 1; j >= 0; j--) {
      M = min(M, lcp[j]);
      mn[sa[j]] = M;
    }
    M = 5005;
    int cnt = 0;
    for (int j = i + 1; j < n; j++) {
      int len = j - i;
      if (i - len + 1 >= 0 &&
          (mn[i - len + 1] >= len || (rnk[i - len + 1] < rnk[i + 1]))) {
        if (M > dp[i][len] + 1) {
          M = dp[i][len] + 1;
        }
        cnt += way[i][len];
        if (cnt >= 1000000007) cnt -= 1000000007;
      }
      if (dp[j][len] > M) {
        dp[j][len] = M;
      }
      way[j][len] += cnt;
      if (way[j][len] >= 1000000007) way[j][len] -= 1000000007;
      if (i - len + 1 >= 0 && mn[i - len + 1] < len &&
          rnk[i - len + 1] > rnk[i + 1]) {
        if (M > dp[i][len] + 1) {
          M = dp[i][len] + 1;
        }
        cnt += way[i][len];
        if (cnt >= 1000000007) cnt -= 1000000007;
      }
    }
  }
  int m = 1000000000;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    cnt += way[n - 1][i];
    if (cnt >= 1000000007) cnt -= 1000000007;
    if (dp[n - 1][i] < n) {
      if (i <= 20) {
        int t = 1, now = dp[n - 1][i];
        for (int j = 0; j < i; j++) {
          int p = n - j - 1;
          if (str[p] == '1') now += t;
          t <<= 1;
        }
        if (m > now) {
          m = now;
        }
      } else {
        if (m == 1000000000) {
          int t = 1, now = dp[n - 1][i];
          for (int j = 0; j < i; j++) {
            int p = n - j - 1;
            if (str[p] == '1') {
              now += t;
              if (now >= 1000000007) now -= 1000000007;
            }
            t <<= 1;
            if (t >= 1000000007) t -= 1000000007;
          }
          m = now;
        }
      }
    }
  }
  printf("%d\n%d\n", cnt, m);
  return 0;
}
