Problem: Dreamoon saw a large integer x written on the ground and wants to print its binary form out. Dreamoon has accomplished the part of turning x into its binary format. Now he is going to print it in the following manner.

He has an integer n = 0 and can only perform the following two operations in any order for unlimited times each:

  1. Print n in binary form without leading zeros, each print will append to the right of previous prints. 
  2. Increase n by 1. 



Let's define an ideal sequence as a sequence of operations that can successfully print binary representation of x without leading zeros and ends with a print operation (i.e. operation 1). Dreamoon wants to know how many different ideal sequences are there and the length (in operations) of the shortest ideal sequence.

The answers might be large so please print them modulo 1000000007 (109 + 7).

Let's define the string representation of an ideal sequence as a string of '1' and '2' where the i-th character in the string matches the i-th operation performed. Two ideal sequences are called different if their string representations are different.

Input

The single line of the input contains a binary integer representing x (1 ≤ x < 25000) without leading zeros.

Output

The first line of the output should contain an integer representing the number of different ideal sequences modulo 1000000007 (109 + 7).

The second line of the output contains an integer representing the minimal length of an ideal sequence modulo 1000000007 (109 + 7).

Examples

Input

101


Output

1
6


Input

11010


Output

3
5

Note

For the first sample, the shortest and the only ideal sequence is «222221» of length 6.

For the second sample, there are three ideal sequences «21211», «212222222221», «222222222222222222222222221». Among them the shortest one has length 5.

Solution (in JAVA):

Solution:
import java.util.*;
import java.io.*;

import static java.lang.Math.*;

public class D {
    final static int MOD = 1_000_000_007;

    int toInt(char[] c, int from, int to) {
        int r = 0;
        for (int i = from; i < to; i++) {
            r = (r * 2 + c[i] - '0') % MOD;
        }
        return r;
    }

    public void run() throws IOException {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        char[] c = (in.next() + "$").toCharArray();
        int n = c.length - 1;
        int[][] lcp = new int[n + 1][n + 1];
        for (int i = n - 1; i >= 0; i--) {
            for (int j = n - 1; j > i; j--) {
                if (c[i] == c[j]) {
                    lcp[i][j] = lcp[i + 1][j + 1] + 1;
                } else {
                    lcp[i][j] = 0;
                }
            }
        }

        int[][] dp = new int[n + 1][n + 1];
        int[][] cnt = new int[n + 1][n + 1];
        int[][] sumcnt = new int[n + 1][n + 1];
        int[][] prefmin = new int[n + 1][n + 1];
        for (int[] z : dp) {
            Arrays.fill(z, Integer.MAX_VALUE);
        }
        for (int[] z : prefmin) {
            Arrays.fill(z, Integer.MAX_VALUE);
        }
        dp[0][0] = 0;
        cnt[0][0] = 1;
        for (int j = 0; j <= n; j++) {
            sumcnt[0][j] = 1;
            prefmin[0][j] = 0;
        }

        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= i; j++) {
                if (c[i - j] != '0') {
                    int until = Math.min(j - 1, i - j);
                    cnt[i][j] = sumcnt[i - j][until];
                    if (prefmin[i - j][until] != Integer.MAX_VALUE) {
                        dp[i][j] = prefmin[i - j][until] + 1;
                    }

                    if (i >= 2 * j) {
                        // k == j
                        int L = lcp[i - 2 * j][i - j];
                        if ((L >= j || L < j && c[i - 2 * j + L] < c[i - j + L]) && dp[i - j][j] != Integer.MAX_VALUE) {
                            dp[i][j] = Math.min(dp[i][j], dp[i - j][j] + 1);
                            cnt[i][j] = (cnt[i - j][j] + cnt[i][j]) % MOD;
                        }
                    }
                }
                sumcnt[i][j] = (sumcnt[i][j - 1] + cnt[i][j]) % MOD;
                prefmin[i][j] = Math.min(prefmin[i][j - 1], dp[i][j]);
            }
        }

        int ansCnt = 0;
        for (int j = 1; j <= n; j++) {
            ansCnt = (ansCnt + cnt[n][j]) % MOD;
        }
        int minCnt = -1;
        for (int j = 1; j <= n; j++) {
            if (dp[n][j] != Integer.MAX_VALUE) {
                if ((j > 20 && minCnt == -1) || (j <= 20 && (minCnt == -1 || toInt(c, n - j, n) + dp[n][j] < minCnt))) {
                    minCnt = (toInt(c, n - j, n) + dp[n][j]) % MOD;
                }
            }
        }
        out.println(ansCnt);
        out.println(minCnt);

        out.close();
    }

    FastScanner in;
    PrintWriter out;

    public static void main(String[] args) throws IOException {
        new D().run();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream in) throws IOException {
            br = new BufferedReader(new InputStreamReader(in));
        }

        String next() {
            try {
                while (st == null || !st.hasMoreTokens()) {
                    st = new StringTokenizer(br.readLine());
                }
            } catch (IOException e) {
                System.err.println(e);
                System.exit(1);
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}