#000196

z-lastchar

A long string is composed by concatenating N times the string S. From the resulting string all the characters at odd positions are removed.Then from the string that remains, again all the characters at odd positions are removed.The process continues until there is only one character left.


Your task is to write a program that finds the last character.
Example: The string PROFILE is written 2 times
--------------------
PROFILEPROFILE
----------------------
-R-F-L-P-O-I-E
-------------------
RFLPOIE
---------------
-F-P-I-
-----------
FPI
---------
-P-
----------
P
------------
So the last character is "P" .
Input In the first line will be the string S, (1<=length(S)<=250), containing only capital letters. The second line will contain N, (1<=N<=1000000000) , number of times the string S is concatenated.

OutputThe output should contain a string, of length 1, which contains only the last remaining character. Don't forget to output the END LINE character after it!

Input
PROFILE
2

OutputP

Input
ABC
10

Output
A

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.