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.*;
public class DreamoonAndBinary
{
	public static final int INFINITY = 100000000;
	public static final long MOD = 1000000007;
	
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		
		String x = in.next();
		int n = x.length();
		
		int[][] zv = zValues(x);

		int[][] length = new int[n][n];
		long[][] count = new long[n][n];
		for(int i = 0; i < length.length; i++)
		{
			Arrays.fill(length[i], INFINITY);
		}
		
		for(int y = 0; y < n; y++)
		{
			length[0][y] = 1;
			count[0][y] = 1;
			
			if(y < n - 1 && x.charAt(y + 1) == '1')
			{
				int index = y + 1;
				for(int z = y; z >= 0; z--)
				{
					int next = y + 1 + y - z;
					if(next < n)
					{
						if(zv[z][y + 1] <= y - z && x.charAt(z + zv[z][y + 1]) == '1' && x.charAt(y + 1 + zv[z][y + 1]) == '0')
						{
							next++;
						}
						
						if(next < n)
						{
							while(index < next)
							{
								index++;
								length[y + 1][index] = length[y + 1][index - 1];
								count[y + 1][index] = count[y + 1][index - 1];
							}
							
							length[y + 1][next] = Math.min(length[y + 1][next], length[z][y] + 1);
							count[y + 1][next] += count[z][y];
							count[y + 1][next] %= MOD;
						}
					}
				}
				
				while(index < n - 1)
				{
					index++;
					length[y + 1][index] = length[y + 1][index - 1];
					count[y + 1][index] = count[y + 1][index - 1];
				}
			}
		}
		
		long number = 0;
		for(int a = 0; a < count.length; a++)
		{
			number += count[a][n - 1];
			number %= MOD;
		}
		
		long result = INFINITY;
		for(int b = n - 1; b >= 0; b--)
		{
			if(length[b][n - 1] < INFINITY)
			{
				if(n - b <= 20)
				{
					result = Math.min(result, length[b][n - 1] + Integer.parseInt(x.substring(b), 2));
				}
				else
				{
					if(result == INFINITY)
					{
						result = 0;
						for(int c = b; c < n; c++)
						{
							result *= 2;
							result %= MOD;
							
							if(x.charAt(c) == '1')
							{
								result++;
							}
						}
						
						result += length[b][n - 1];
						result %= MOD;
					}
					
					break;
				}
			}
		}
		
		System.out.println(number);
		System.out.println(result);
	}
	
	public static int[][] zValues(String s)
	{
		int[][] zv = new int[s.length()][s.length()];
		
		for(int a = 0; a < zv.length; a++)
		{
			zv[a][a] = s.length() - a;
			
			int l = 0;
			int r = 0;
			for(int i = 1; i < s.length() - a; i++)
			{
				if(i > r)
				{
					l = i;
					r = i;
					
					while(r < s.length() - a && s.charAt(a + r - l) == s.charAt(a + r))
					{
						r++;
					}
					
					r--;
					zv[a][a + i] = r - l + 1;
				}
				else
				{
					int k = i - l;
					
					if(zv[a][a + k] < r - i + 1)
					{
						zv[a][a + i] = zv[a][a + k];
					}
					else
					{
						l = i;
						
						while(r < s.length() - a && s.charAt(a + r - l) == s.charAt(a + r))
						{
							r++;
						}
						
						r--;
						zv[a][a + i] = r - l + 1;
					}
				}
			}
		}
		
		return zv;
	}
}