Sequence (2)#1084

Sequence (2)

1 second
64 megabytes
Easy

Each member of the sequence of decimal digits d_1, d_2, d_3, \ldots starting from the fourth is equal to the last digit of the sum of the previous three digits. Given d_1, d_2, d_3, find the -th term of the sequence.

Input

The first line contains the digits d_1, d_2, d_3 separated by spaces. The second line contains the number .

1 \leq N \leq 10^{15}.

Output

Print a single digit: d_N.

Examples

Example 1

Loading
Loading