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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
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);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    private static final int MODULO = (int) 1e9 + 7;
    private static final int INF = (int) 1e9;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int[] a = convert(in.next());
        int n = a.length;
        int[][] lcp = new int[n][n];
        for (int i = n - 1; i >= 0; --i)
            for (int j = n - 1; j >= 0; --j)
                if (a[i] != a[j])
                    lcp[i][j] = 0;
                else
                    lcp[i][j] = 1 + (i + 1 < n && j + 1 < n ? lcp[i + 1][j + 1] : 0);
        out.println(solveCount(a, lcp));
        out.println(solveMin(a, lcp));
    }

    private int solveMin(int[] a, int[][] lcp) {
        int n = a.length;
        int[] lastOne = new int[n];
        lastOne[0] = a[0] == 1 ? 0 : -1;
        for (int i = 1; i < n; ++i) {
            lastOne[i] = lastOne[i - 1];
            if (a[i] == 1) lastOne[i] = i;
        }
        int[][] f = new int[n][n];
        for (int[] ff : f) Arrays.fill(ff, INF);
        for (int i = 0; i < n; ++i) {
            for (int j = i, k = j; j >= 0; --j) if (a[j] != 0) {
                if (j == 0) {
                    f[j][i] = 1;
                } else {
                    if (k >= j) k = lastOne[j - 1];
                    while (k > 0 && lastOne[k - 1] != -1 && compare(lastOne[k - 1], j - 1, j, i, a, lcp) <= 0)
                        k = lastOne[k - 1];
                    if (k != -1 && compare(k, j - 1, j, i, a, lcp) <= 0)
                        f[j][i] = f[k][j - 1] + 1;
                }
            }
            for (int j = i - 1; j >= 0; --j)
                f[j][i] = Math.min(f[j][i], f[j + 1][i]);
        }
        BigInteger best = null;
        BigInteger pow2 = BigInteger.valueOf(1);
        BigInteger end = BigInteger.ZERO;
        for (int right = 1; right <= n; ++right) {
            if (a[n - right] == 1)
                end = end.add(pow2);
            if (f[n - right][n - 1] < INF) {
                BigInteger length = end.add(BigInteger.valueOf(f[n - right][n - 1]));
                if (best == null || length.compareTo(best) < 0)
                    best = length;
            }
            pow2 = pow2.add(pow2);
        }
        return best.mod(BigInteger.valueOf(MODULO)).intValue();
    }

    private int solveCount(int[] a, int[][] lcp) {
        int n = a.length;
        int[][] f = new int[n][n];
        for (int i = n - 1; i >= 0; --i) if (a[i] != 0) {
            for (int j = i, k = i; j < n; ++j) if (j + 1 == n || a[j + 1] != 0) {
                if (j + 1 == n) f[i][j] = 1;
                else {
                    if (k <= j) k = j + 1;
                    while (k < n && compare(i, j, j + 1, k, a, lcp) > 0) ++k;
                    if (k < n) f[i][j] = f[j + 1][k];
                }
            }
            for (int j = n - 2; j >= i; --j) {
                f[i][j] += f[i][j + 1];
                if (f[i][j] >= MODULO) f[i][j] -= MODULO;
            }
        }
        return f[0][0];
    }

    private int compare(int a, int b, int x, int y, int[] seq, int[][] lcp) {
        int len1 = b - a + 1;
        int len2 = y - x + 1;
        if (len1 != len2) return len1 - len2;
        int common = Math.min(lcp[a][x], len1);
        if (common == len1) return 0;
        return seq[a + common] - seq[x + common];
    }

    private int[] convert(String string) {
        int[] answer = new int[string.length()];
        for (int i = 0; i < string.length(); ++i)
            answer[i] = string.charAt(i) - '0';
        return answer;
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        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();
    }

}