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

public class D {

	static final int MOD = 1000000007;

	static int add(int a, int b) {
		a += b;
		if (a >= MOD) {
			a -= MOD;
		}
		return a;
	}

	static void solve() throws IOException {
		String s = next();
		int n = s.length();
		int[][] dp1 = new int[n][n];
		for (int i = 0; i < n; i++) {
			dp1[0][0] = 1;
		}
		int[][] lcp = new int[n][n];
		for (int i = n - 1; i >= 0; i--) {
			for (int j = n - 1; j >= 0; j--) {
				if (s.charAt(i) == s.charAt(j)) {
					lcp[i][j] = (i + 1 < n && j + 1 < n ? lcp[i + 1][j + 1] : 0) + 1;
				} else {
					lcp[i][j] = 0;
				}
			}
		}
		for (int left = 0; left < n; left++) {
			int[] dpl = dp1[left];
			for (int right = left + 1; right < n; right++) {
				dpl[right] = add(dpl[right], dpl[right - 1]);
			}
			for (int right = left; right + 1 < n; right++) {
				if (s.charAt(right + 1) != '1')
					continue;
				int len = right - left + 1;
				int cLcp = lcp[left][right + 1];
				if (cLcp < len)
					if (cLcp + right + 1 >= n || s.charAt(left + cLcp) == '1') {
						len++;
					}
				if (right + len < n) {
					dp1[right + 1][right + len] = add(dp1[right + 1][right
							+ len], dpl[right]);
				}
			}
		}
		int[][] dp2 = new int[n][n];
		for (int[] e : dp2) {
			Arrays.fill(e, Integer.MAX_VALUE);
		}
		dp2[0][0] = 1;
		for (int left = 0; left < n; left++) {
			int[] dpl = dp2[left];
			for (int right = left + 1; right < n; right++) {
				dpl[right] = Math.min(dpl[right], dpl[right - 1]);
			}
			for (int right = left; right + 1 < n; right++) {
				if (dpl[right] == Integer.MAX_VALUE)
					continue;
				if (s.charAt(right + 1) != '1')
					continue;
				int len = right - left + 1;
				int cLcp = lcp[left][right + 1];
				if (cLcp < len)
					if (cLcp + right + 1 >= n || s.charAt(left + cLcp) == '1') {
						len++;
					}
				if (right + len < n) {
					dp2[right + 1][right + len] = Math.min(dp2[right + 1][right
							+ len], dpl[right] + 1);
				}
			}
		}
		int ans = 0;
		for (int left = 0; left < n; left++) {
			ans = add(ans, dp1[left][n - 1]);
		}
		BigInteger ans2 = null;
		for (int left = 0; left < n; left++) {
			int val = dp2[left][n - 1];
			if (val == Integer.MAX_VALUE)
				continue;
			BigInteger cur = new BigInteger(s.substring(left, n), 2)
					.add(BigInteger.valueOf(val));
			if (ans2 == null || ans2.compareTo(cur) > 0)
				ans2 = cur;
		}
		out.println(ans);
		out.println(ans2.mod(BigInteger.valueOf(MOD)));
	}

	static BufferedReader br;
	static StringTokenizer st;
	static PrintWriter out;

	public static void main(String[] args) throws IOException {
		InputStream input = System.in;
		PrintStream output = System.out;
		File file = new File("d.in");
		if (file.exists() && file.canRead()) {
			input = new FileInputStream(file);
			output = new PrintStream("d.out");
		}
		br = new BufferedReader(new InputStreamReader(input));
		out = new PrintWriter(output);
		solve();
		out.close();
		br.close();
	}

	static boolean hasNext() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String line = br.readLine();
			if (line == null) {
				return false;
			}
			st = new StringTokenizer(line);
		}
		return true;
	}

	static String next() throws IOException {
		return hasNext() ? st.nextToken() : null;
	}

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

	static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

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