Patterns#1785

Patterns

1 secondo
64 megabyte
Facile

A pattern of size is a string of length , where each character belongs to the set \{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, g, ?\}. Patterns are converted into strings of digits according to the following rules:

Given two patterns: p_1 and p_2. Let S_1 be the set of strings that can be obtained from p_1 according to the rules described, and S_2 the set of strings obtained from p_2. Find the number of strings contained in both sets.

Input

The first line contains the pattern p_1, the second line contains the pattern p_2. The patterns have the same positive length, not exceeding .

Output

Print the answer to the problem.

Esempi

Esempio 1

Loading
Loading