Problems
Patterns
Patterns
The pattern of size \textbf{n} is called a string of length \textbf{n}, each of the characters which belong to the set \textbf{\{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, g, ?\}}. Templates are converted into strings of digits the following rules:
\begin{itemize}
\item characters \textbf{0} to \textbf{9} can be converted only to themselves;
\item symbol \textbf{а} can be converted to any of the symbols \textbf{0}, \textbf{1}, \textbf{2}, \textbf{3};
\item symbol \textbf{b} can be converted to any of the symbols \textbf{1}, \textbf{2}, \textbf{3}, \textbf{4};
\item symbol \textbf{с} can be converted to any of the symbols \textbf{2}, \textbf{3}, \textbf{4}, \textbf{5};
\item symbol \textbf{d} can be converted to any of the symbols \textbf{3}, \textbf{4}, \textbf{5}, \textbf{6};
\item symbol \textbf{е} can be converted to any of the symbols \textbf{4}, \textbf{5}, \textbf{6}, \textbf{7};
\item symbol \textbf{f} can be converted to any of the symbols \textbf{5}, \textbf{6}, \textbf{7}, \textbf{8};
\item symbol \textbf{g} can be converted to any of the symbols \textbf{6}, \textbf{7}, \textbf{8}, \textbf{9};
\item symbol \textbf{?} can be converted to any of the symbols from \textbf{0} to \textbf{9}.
\end{itemize}
Given two patterns: \textbf{p}_1 and \textbf{p_2}. Consider the set of \textbf{S_1} lines that can be derived from \textbf{p_1} by the rules outlined, and plenty of S2 lines that can be derived from \textbf{p_2}. Need to find a number of lines included in both sets.
\InputFile
The first line contains the pattern \textbf{p_1}, the second - a pattern \textbf{p_2}. Patterns have the same positive amount, not exceeding \textbf{9}.
\OutputFile
In the output file output response to the problem.
Input example #1
??? abc
Output example #1
64