P25335 [AtCoder] Very Long String
入门
题目描述

Problem Description

The string $ S $ is a string obtained by concatenating the string $ A $ $ 10^{100} $ times.

Output the character at the $ B $th position of the string $ S $.

Input Format

The input is given from the standard input in the following format:

$ A $ $ B $

  • The first line contains the string $A\ (1\ ≦\ |A|\ ≦\ 50)$.
  • The string $ A $ is guaranteed to consist only of lowercase alphabets.
  • The second line contains the integer $B\ (1\ ≦\ B\ ≦\ 1,000,000,000)$.

Output Format

Output the character at the $ B $th position of the string $ S $ in one line. Include a newline at the end of the output.

Sample Input and Output

Sample Input #1

abc
7

Sample Output #1

a

Sample Input #2

bbb
9

Sample Output #2

b

Sample Input #3

kljhasdfkjahfadfakhsdfaklh
1000000000

Sample Output #3

h

Notes/Hints

Partial Points

  • Correctly solving all test cases where $1\ ≦\ B\ ≦\ 100,000$ will award $ 20 $ points.
  • Correctly solving the remaining test cases will award an additional $ 80 $ points.

Sample Explanation 1

The string $ S $ is the string abcabcabcabc…. Therefore, the 7th character is a.

Sample Explanation 2

Since all characters in the string $ S $ are b, the 9th character is also b.

Sample Explanation 3

Note that a large integer may be given as input.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
abc 7
样例输出
a