King Dongmyeong founded Goguryeo, and his birth name was Jumong. Jumong had a son named Yuri with his first wife, queen Yesoya, and two sons named Biryu and Onjo with his second wife, queen So Seo-no. They all lived together happily until the time came for Jumong to name his true heir. The two candidates for the crown prince are Yuri and Biryu.
To prevent a civil war, Jumong designed a game similar to a lottery and announced that whoever won it would become the crown prince. At the start of the game Jumong fixes an integer n, and each candidate chooses a binary string of length n, meaning a string made only of 0s and 1s. The two chosen strings must be different. If they are equal, the choosing step is repeated.
Once Jumong holds two different strings of the same length, he tosses a fair coin (heads and tails are equally likely) several times. Writing heads as 0 and tails as 1, the tosses build a binary string that grows to the right. The candidate whose own string appears first inside that growing string wins the game and becomes the crown prince.
Given the binary strings chosen by Yuri and Biryu, compute the probability that Yuri wins.
The input contains several test cases. Each test case is one line holding two binary strings separated by a single space, the string chosen by Yuri first and the string chosen by Biryu second. The two strings are different and have the same length, and that length is at most 30. The last line is 0 0, and it must not be processed.
Print the answer for the i-th test case on the i-th line. Each line holds one real number, the probability that Yuri wins, rounded at the fourth digit after the decimal point and printed to the third digit. Always fill all three digits, as in 0.500 or 1.000. No input has an answer that falls exactly on a rounding boundary.