Hide

Problem F
Triple Sevens

Eddy is overseeing construction of some new slot machines. His slot machines consist of three wheels, each of which can show one of several different digits. When activated, each wheel shows a random digit. The goal is for all wheels to be able to show the digit $7$.

A slot machine is good if each wheel is capable of showing the digit $7$, and bad otherwise. For a given slot machine, determine if it is good or bad.

Input

The first line contains a single integer $n$ $(1 \leq n \leq 10)$, which is the number of different digits on each wheel. Each wheel has the same number of digits.

Each of the next three lines contains $n$ distinct digits (in the range from $0$ to $9$). These are the digits on each of the three wheels.

Output

Output a single integer, which is $777$ if the slot machine is good, $0$ otherwise.

Sample Input 1 Sample Output 1
2
0 7
7 3
7 0
777
Sample Input 2 Sample Output 2
2
0 7
7 3
3 9
0

Please log in to submit a solution to this problem

Log in