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.awt.Dimension;

import java.io.*;
import static java.lang.Math.*;
import java.math.BigInteger;
import static java.math.BigInteger.*;
import java.util.*;
import static java.util.Arrays.*;
//import java.math.BigInteger;
//import static java.lang.Character.*;
//import static java.lang.Math.*;
//import static java.math.BigInteger.*;
//import static java.util.Arrays.*;
//import java.awt.Point; // interger !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//import java.awt.Polygon;
//import java.awt.Rectangle;
//import java.awt.geom.AffineTransform;
//import java.awt.geom.Line2D;
//import java.awt.geom.Point2D;
//import javafx.scene.shape.Line;
//import javafx.scene.transform.Rotate;

//<editor-fold defaultstate="collapsed" desc="Main">
public class Ideone {
    // https://netbeans.org/kb/73/java/editor-codereference_ru.html#display

    private void run() {
        try {
            Locale.setDefault(Locale.US);
        } catch (Exception e) {
        }
        boolean oj = true;
        try {
            oj = System.getProperty("MYLOCAL") == null;
        } catch (Exception e) {
        }

        if (oj) {
            sc = new FastScanner(new InputStreamReader(System.in));
            out = new PrintWriter(new OutputStreamWriter(System.out));
        } else {
            try {
                sc = new FastScanner(new FileReader("input.txt"));
                out = new PrintWriter(new FileWriter("output.txt"));
            } catch (IOException e) {
                MLE();
            }
        }
        Solver s = new Solver();
        s.sc = sc;
        s.out = out;
        s.solve();
        if (!oj) {
            err.println("Time: " + (System.currentTimeMillis() - timeBegin) / 1e3);
            err.printf("Mem: %d\n", (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20);
        }
        out.flush();
    }

    private void show(int[] arr) {
        for (int v : arr) {
            err.print(" " + v);
        }
        err.println();
    }

    public static void exit() {
        err.println("Time: " + (System.currentTimeMillis() - timeBegin) / 1e3);
        err.printf("Mem: %d\n", (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20);
        out.flush();
        out.close();
        System.exit(0);
    }

    public static void MLE() {
        int[][] arr = new int[1024 * 1024][];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = new int[1024 * 1024];
        }
    }

    public static void main(String[] args) {
        new Ideone().run();
    }

    static long timeBegin = System.currentTimeMillis();
    static FastScanner sc;
    static PrintWriter out;
    static PrintStream err = System.err;
}
    //</editor-fold>

//<editor-fold defaultstate="collapsed" desc="FastScanner">
class FastScanner {

    BufferedReader br;
    StringTokenizer st;

    FastScanner(InputStreamReader reader) {
        br = new BufferedReader(reader);
        st = new StringTokenizer("");
    }

    String next() {
        while (!st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception ex) {
                return null;
            }
        }
        return st.nextToken();
    }

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

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

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

    String nextLine() {
        try {
            return br.readLine();
        } catch (IOException ex) {
            return null;
        }
    }
}
//</editor-fold>

class Solver {

    void aser(boolean OK) {
        if (!OK) {
            Ideone.MLE();
        }
    }

    FastScanner sc;
    PrintWriter out;
    static PrintStream err = System.err;

    final int inf = Integer.MAX_VALUE / 2;
    final long mod = (long)1e9 + 7;
    int n;
    String str;
    char[] s;
    long[][] way, cntOut;
    int[][] lenEq;
    
    
    int cmp( int a, int b, int len ){
        if( len <= lenEq[a][b] ) return 0;
        return s[a + lenEq[a][b]]   -   s[b + lenEq[a][b]];
    }
    
    void solve() {
        s = (str=sc.next()).toCharArray();
        n = s.length;
        
        lenEq = new int[n][n];
        for( int i = n-1; 0 <= i; --i )
            for( int j = n-1; 0 <= j; --j )
                if( s[i] == s[j] ){
                    if( i+1 < n && j+1 < n )
                        lenEq[i][j] = lenEq[i+1][j+1];
                    ++lenEq[i][j];
                }
        
        way = new long[n][];
        cntOut = new long[n][];
        for (int r = 0; r < n; r++) {
            way[r] = new long[r+1 + 1];
            cntOut[r] = new long[r+1 + 1];
            fill( cntOut[r], inf );
            for (int cntBits = 1; cntBits <= r+1; cntBits++) {
                int l = r - cntBits + 1;
                int j = l - 1;
                int i = max(0, j - cntBits + 1);
                if( s[l] == '1' ){
                    if( l == 0 ){
                        way[r][cntBits] = 1;
                        cntOut[r][cntBits] = 1;
                    }
                    else{
                        if( r-l==j-i && cmp(i,l,cntBits) > 0 )
                            ++i;
                        way[r][cntBits] += way[j][j-i+1];
                        cntOut[r][cntBits] = min( inf, 1 + cntOut[j][j-i+1] );
                    }
                }
                way[r][cntBits] += way[r][cntBits-1];
                way[r][cntBits] %= mod;
                if( r != n-1 ){
                    cntOut[r][cntBits] = min( cntOut[r][cntBits], cntOut[r][cntBits-1] );
                }
            }
        }
        out.println(way[n-1][n]);
        
        BigInteger ans = null;
        for (int lenLast = 1; lenLast <= n; lenLast++) {
            if( cntOut[n-1][lenLast] == inf ) continue;
            BigInteger curAns = valueOf(cntOut[n-1][lenLast])
                .add( new BigInteger(str.substring(n-lenLast),2) );
            if( ans == null )
                ans = curAns;
            else
                ans = ans.min(curAns);
            if( lenLast == n/2 ) System.gc();
        }
        out.println( ans.mod(valueOf(mod)) );
    } 

}