#H2025a. Algorithm Memories

Algorithm Memories

Description

To perform better in the competition, you need to unlock your algorithm memories.

However, your memories are locked behind a password — a string of exactly 55 lowercase letters.

You have tried a guess password, and the system returned a response string consisting of digits 0\texttt{0}, 1\texttt{1} or 2\texttt{2}:

  • 0\texttt{0} means the letter does not appear in the correct password.
  • 1\texttt{1} means the letter exists in the correct password but not at this position.
  • 2\texttt{2} means the letter is correct and in the correct position.

Your task is to determine how many possible passwords are consistent with the guess and the response.

Format

Input

The first line contains a string with 55 lowercase letters, the password you guessed.

The second line contains a string with 55 digits, the response.

Output

One integer, the number of possible passwords.

Samples

maidx
20212
24