Sum
We are going to create an infinite sequence of digits using a specific method. Start with three given digits. For each subsequent digit, add the last three digits of the sequence and append the digits of the result to the sequence. For instance, starting with the digits 123 produces an infinite sequence beginning with 12361181091010, and starting with 971 results in a sequence beginning with 971179171715. This sequence represents the fractional part of a decimal fraction (with the integer part assumed to be zero). Your task is to write a program that reads the first three digits of two sequences and outputs the N-th digit of the fractional part of the sum of the two decimal fractions derived from the input.
Input
The input file contains the first three digits of the first sequence on the first line, and the first three digits of the second sequence on the second line. This is followed by one or more lines, each containing an integer N_i (1 ≤ N_i < 10^100, 1 ≤ i ≤ 20).
Output
For each N_i, output a line with the N_i-th digit of the fractional part of the sum of the two decimal fractions corresponding to the input data.