Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official.
×

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

The problem statement has recently been changed. View the changes.

×
D. Dreamoon and Binary

time limit per test

2 secondsmemory limit per test

512 megabytesinput

standard inputoutput

standard outputDreamoon 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:

- Print n in binary form without leading zeros, each print will append to the right of previous prints.
- 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 (10^{9} + 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* < 2^{5000}) without leading zeros.

Output

The first line of the output should contain an integer representing the number of different ideal sequences modulo 1000000007 (10^{9} + 7).

The second line of the output contains an integer representing the minimal length of an ideal sequence modulo 1000000007 (10^{9} + 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.

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Sep/21/2021 18:22:18 (h2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|