P12778 [HackerEarth] bytelandian conversions
普及
题目描述

In Byteland,conversion of numbers between different bases has always been a herculian task.They always make errors in these conversions.
People in Byteland always write one of the digits wrong when they convert a number to a new base and write it down. For example, when they convert
the number 56 into binary (base 2), the correct result should be
"110", but they might instead write down "010" or "111". They never
accidentally delete or add digits, so they might write down a number with
a leading digit of "0" if this is the digit they get wrong.

You are given Bytelandians' output when converting a number N into base 2 and base 3,
Find out the correct original value of N (in base 10). You can
assume that there is a unique solution for N.

Input
There are 2 lines:
Line 1: The base-2 representation of N, with one digit written
incorrectly.
Line 2: The base-3 representation of N, with one digit written
incorrectly.

Output
The correct value of N

Constraints
N ≤ 1 billion

SAMPLE INPUT
1010
212

SAMPLE OUTPUT
14

输入格式

见题面

输出格式

见题面

样例输入
1010 212 SAMPLE
样例输出
14