Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

NDIGIT - The Nth digit

The number A(K) is defined by writing the numbers 1^K, 2^K, 3^K, ... sucessively in a right to left order.

For example, A(1) = ...181716151413121110987654321.

A(2)= ...169144121100816449362516941.

Consider the sum S = A(1) + A(2). The end of S is: ...350860272513937560350171262.

Given N, K1, K2. Your task is to find the N-th digit from the right of S = A(K1) + A(K2)(the rightmost digit of S is counted as the first digit).

Input

There are 3 sub test cases. Each test case is written in a line containing 3 integers N, K1, K2 (1 ≤ K1, K2 ≤ 5. 1 ≤ N ≤ 1,000,000,000)

Output

Print out 3 corresponding answers to the sub test cases.

Grading

In each test case, you will get 5 marks for 3/3 correct answers, 3 marks for 2/3 correct answers, 1 marks for 1 correct answer, and 0 otherwise.

Example

Input
1 1 2
3 1 2
5 1 2

Output
2
2
7

Được gửi lên bởi:Lê Đôn Khuê
Ngày:2008-06-27
Thời gian chạy:1.639s
Giới hạn mã nguồn:10000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Ngôn ngữ cho phép:Tất cả ngoại trừ: ERL GOSU JS-RHINO NODEJS PERL6 PYPY RUST SED VB.NET
Nguồn bài:VNOI Marathon '08 - Round 3/DivA
Problem Setter: Lê Đôn Khuê

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.