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.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.InputStream;



public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {

    static final int MOD = 1000000007;
    static final int MAXL = 5005;
    char[] s;
    int[][] cnt, len, same;
    int n;

    boolean compare(int l1, int r1, int l2, int r2) {
        if (r1 - l1 != r2 - l2) return (r1 - l1) < (r2 - l2);
        for (int i = 0; l1 + i <= r1; ++i) {
            if (s[l1 + i] != s[l2 + i]) return s[l1 + i] < s[l2 + i];
        }
        return true;
    }


    boolean check(int l, int r) {
        int p = 2 * l - r - 1;
        int length = r - l + 1;
        int sameLength = same[p][l];
        if (sameLength >= length) return true;
        return s[p + sameLength] <= s[l + sameLength];
    }

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        String string = in.next();
        s = string.toCharArray();
        n = s.length;
        cnt = new int[n][n];
        len = new int[n][n];
        same = new int[n + 1][n + 1];

        for (int i = n - 1; i >= 0; --i)
            for (int j = n - 1; j >= 0; --j) {
                if (s[i] == s[j]) same[i][j] = Math.max(same[i][j], same[i + 1][j + 1] + 1);
            }

        int total = 0;
        for (int l = 0; l < n; ++l) {
            int sum = 0, minL = MAXL;

            for (int r = l; r < n; ++r) {
                if (l == 0) {
                    cnt[l][r] = 1;
                    len[l][r] = 1;
                } else {
                    len[l][r] = MAXL;
                    cnt[l][r] = 0;
                    if (s[l] == '1' ) {
                        int p = 2 * l - r - 1;
                        if (p >= 0 && s[p] == '1' && check(l, r)) {
                            sum = (sum + cnt[p][l - 1]) % MOD;
                            minL = Math.min(minL, len[p][l - 1]);
                        }
                        cnt[l][r] = sum;
                        len[l][r] = minL + 1;
                        if (p >= 0 && s[p] == '1' && !check(l, r)) {
                            sum = (sum + cnt[p][l - 1]) % MOD;
                            minL = Math.min(minL, len[p][l - 1]);
                        }
                    }
                }
                if (r == n - 1) {
                    total = (total + cnt[l][r]) % MOD;
                }
            }
        }
        BigInteger minLength = BigInteger.ONE.shiftLeft(n + 1);
        BigInteger tmp = BigInteger.ZERO;
        for (int i = n - 1; i >= 0; --i) {
            if (s[i] == '1') tmp = tmp.setBit(n - i - 1);
            if (len[i][n - 1] < MAXL) {
                minLength = minLength.min(tmp.add(BigInteger.valueOf(len[i][n - 1])));
            }
        }
        out.println(total);
        out.println(minLength.mod(BigInteger.valueOf(MOD)));
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

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

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