시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 5 4 4 100.000%

문제

\(\odot : \left\{0, 1, \dots , 9 \right\} \times \left\{0, 1, \dots , 9 \right\} \rightarrow \left\{0, 1, \dots , 9 \right\} \) 인 연산자 \(\odot\)가 있다. 이 연산자는 \(0 \odot 0 = 0\) 을 만족한다고 한다.

또다른 연산자 \(\otimes : \mathbb{Z}_{0+} \times \mathbb{Z}_{0+} \rightarrow \mathbb{Z}_{0+}\) 는 연산자 \(\odot\) 을 이용해서 정의가 가능한데, \(a \otimes b\) 는 각 자리수마다 (\(a\)의 i번째 자리 수) \(\odot\) (\(b\)의 i번째 자리 수) 의 결과값을 i번째 자리 수로 사용한 숫자가 결과값이 된다.

예를 들어 \(a \odot b (a \times b) % 10\) 으로 정의되었다면 \(5566 \otimes 239\) 의 결과값을 구하는 과정은 아래와 같다.

\( \begin{align*} 5566& \\ \underline{\otimes \quad 239}& \\ ????& \end{align*} \) →  \( \begin{align*} 5566& \\ \underline{\otimes \quad 0239}& \\ ????& \end{align*} \) → \(  \begin{align*} 5& \\ \underline{\odot \quad 0}& \\ 0& \end{align*} \) \( \begin{align*} 5& \\ \underline{\odot \quad 2}& \\ 0& \end{align*} \) \( \begin{align*} 6& \\ \underline{\odot \quad 3}& \\ 8& \end{align*} \) \(\begin{align*} 6& \\ \underline{\odot \quad 9}& \\ 4& \end{align*} \) → \(  \begin{align*} 5566& \\ \underline{\otimes \quad 0239}& \\ 0084& \end{align*} \) → \(  \begin{align*} 5566& \\ \underline{\otimes \quad 239}& \\ 84& \end{align*}  \)

연산자 \(\odot\)의 내용과 두 음이아닌 정수 \(a\), \(b\)가 주어졌을 때 (\(a \le b\)), \(a \otimes (a + 1) \otimes (a + 2) \otimes \dots \otimes (b - 1) \otimes b\) 를 구하여라.

\(\otimes\)연산자의 계산 순서는 왼쪽부터 계산한다. 즉, \(a \otimes b \otimes c\) = \((a \otimes b) \otimes c\)로 취급한다.

입력

첫 10줄 각각에는 10개의 수가 주어진다. \(i\)번째 줄의 \(j\)번재 숫자는 \((i−1) \odot (j−1)\) 의 결과값을 나타낸다. \(0 \odot 0\) 은 항상 \(0\)이다.

이어 11번째 줄에는 2개의 정수 \(a\) \(b\)가 주어진다. (0 ≤ \(a\) ≤ \(b\) ≤ 1018)

출력

\(a\)부터 \(b\)까지 모든 수를 \(\otimes\) 연산한 결과값을 출력한다. 불필요한 0은 출력하지 않는다.

예제 입력 1

0 1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 0
2 3 4 5 6 7 8 9 0 1
3 4 5 6 7 8 9 0 1 2
4 5 6 7 8 9 0 1 2 3
5 6 7 8 9 0 1 2 3 4
6 7 8 9 0 1 2 3 4 5
7 8 9 0 1 2 3 4 5 6
8 9 0 1 2 3 4 5 6 7
9 0 1 2 3 4 5 6 7 8
0 10

예제 출력 1

15
W3sicHJvYmxlbV9pZCI6IjM1MTkiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWFjYzRcdWMwYjBcdWM2NTUgXHVjNWYwXHVjMGIwXHVhZDcwIiwiZGVzY3JpcHRpb24iOiI8cD5cXChcXG9kb3QgOiBcXGxlZnRcXHswLCAxLCBcXGRvdHMgLCA5IFxccmlnaHRcXH0gXFx0aW1lcyBcXGxlZnRcXHswLCAxLCBcXGRvdHMgLCA5IFxccmlnaHRcXH0gXFxyaWdodGFycm93IFxcbGVmdFxcezAsIDEsIFxcZG90cyAsIDkgXFxyaWdodFxcfSBcXCkgXHVjNzc4IFx1YzVmMFx1YzBiMFx1Yzc5MCBcXChcXG9kb3RcXClcdWFjMDAgXHVjNzg4XHViMmU0LiBcdWM3NzQgXHVjNWYwXHVjMGIwXHVjNzkwXHViMjk0IFxcKDAgXFxvZG90IDAgPSAwXFwpJm5ic3A7XHVjNzQ0IFx1YjljY1x1Yzg3MVx1ZDU1Y1x1YjJlNFx1YWNlMCBcdWQ1NWNcdWIyZTQuPFwvcD5cclxuXHJcbjxwPlx1YjY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