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.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class CF272D {

    public static int find(char[] num, int[][] dp, int mid, int[][] minimumNext) {
        int n = num.length;
        for (int[] a : dp)
            Arrays.fill(a, 1 << 25);
        for (int i = 0; i < n; i++)
            if (i + mid >= n)
                dp[i][n - 1] = 1;
        for (int i = n - 1; i >= 0; i--) {
            if (num[i] != '0')
                for (int j = Math.min(n - 2, i + mid - 1); j >= i; j--) {
                    int nxt = minimumNext[i][j];
                    if (nxt != -1)
                        dp[i][j] = 1 + dp[j + 1][nxt - 1];
                    dp[i][j] = Math.min(dp[i][j], dp[i][j + 1]);
                }
        }
        return dp[0][0];

    }

    public static void main(String[] args) {
        int MOD = 1_000_000_007;
        Scanner in = new Scanner(System.in);
        char[] num = in.nextLine().toCharArray();
        int n = num.length;
        int[] nextOne = new int[n + 1];
        nextOne[n] = n;
        for (int i = n - 1; i >= 0; i--) {
            nextOne[i] = nextOne[i + 1];
            if (num[i] == '1')
                nextOne[i] = i;
        }
        int[][] firstDiff = new int[n + 1][n + 1];
        for (int i = 0; i <= n; i++)
            firstDiff[i][n] = firstDiff[n][i] = n;
        for (int i = n - 1; i >= 0; i--)
            for (int j = n - 1; j >= 0; j--) {
                if (num[i] != num[j])
                    firstDiff[i][j] = i;
                else
                    firstDiff[i][j] = firstDiff[i + 1][j + 1];
            }
        int[][] minimumNext = new int[n + 1][n + 1];
        for (int i = 0; i < n; i++)
            for (int j = i; j < n; j++) {
                if (n - (j + 1) < j - i + 1 || (j < n - 1 && num[j + 1] == '0'))
                    minimumNext[i][j] = -1;
                else {
                    int diff = firstDiff[i][j + 1];
                    if (diff > j)
                        minimumNext[i][j] = nextOne[j + 1 + (j - i + 1)];
                    else {
                        if (num[diff] == '1') {
                            if (j + 1 + (j - i + 1) < n)
                                minimumNext[i][j] = nextOne[j + 1 + (j - i + 1)
                                        + 1];
                            else
                                minimumNext[i][j] = -1;
                        } else
                            minimumNext[i][j] = nextOne[j + 1 + (j - i + 1)];
                    }
                }
            }
        int[][] dp = firstDiff;
        for (int[] a : dp)
            Arrays.fill(a, 0);
        for (int i = 0; i < n; i++)
            if (num[i] == '1')
                dp[i][n - 1] = 1;
        for (int i = n - 1; i >= 0; i--) {
            if (num[i] == '1')
                for (int j = n - 2; j >= i; j--) {
                    int nxt = minimumNext[i][j];
                    if (nxt != -1)
                        dp[i][j] = dp[j + 1][nxt - 1];
                    dp[i][j] = (dp[i][j] + dp[i][j + 1]) % MOD;

                }
        }
        int sum = dp[0][0];
        // [i, j] -> [j + 1, k]
        int lo = 1;
        int hi = n;
        while (hi > lo) {
            int mid = (lo + hi) / 2;
            int k = find(num, dp, mid, minimumNext);
            if (k < 1 << 25) {
                hi = mid;
            } else
                lo = mid + 1;
        }
        int mid = hi;
        int req = find(num, dp, mid, minimumNext);
        char[] rnum = new char[mid];
        for (int i = 0; i < mid; i++)
            rnum[i] = num[n - mid + i];
        BigInteger b = new BigInteger(new String(rnum), 2);
        b = b.add(new BigInteger(req + ""));

        if (mid < 15) {
            for (int i = 1; i < 15 && i <= n; i++) {
                mid = i;
                req = find(num, dp, mid, minimumNext);
                if (req >= 1 << 25)
                    continue;
                rnum = new char[mid];
                for (int j = 0; j < mid; j++)
                    rnum[j] = num[n - mid + j];
                BigInteger b2 = new BigInteger(new String(rnum), 2);
                b2 = b2.add(new BigInteger(req + ""));
                if (b2.compareTo(b) < 0)
                    b = b2;
            }
        }

        System.out.println(sum);
        System.out.println(b.mod(new BigInteger(MOD + "")));
    }
}