// Arup Guha
// 2/9/2017
// Solution to 2017 January USACO Silver Problem: Secret Cow Code

import java.util.*;
import java.io.*;

public class cowcode {

	public static String s;
	public static long len;

	public static void main(String[] args) throws Exception {

		// Read input.
		Scanner stdin = new Scanner(new File("cowcode.in"));
		s = stdin.next();
		long index = stdin.nextLong()-1;
		len = s.length();

		// Output the result.
		PrintWriter out = new PrintWriter(new FileWriter("cowcode.out"));
		out.println(solve(index));

		out.close();
		stdin.close();
	}

	public static char solve(long index) {

		// Base case, we map back to the original string!
		if (index < len) return s.charAt((int)index);

		// Keep on shifting till we're big enough.
		long mylen = len;
		while (mylen <= index) mylen <<= 1;

		// New index in second half of the string.
		long newindex = index - mylen/2;

		// Do left-shift to undo right shift operation - remember this string is half as long.
		newindex = (newindex -1 + mylen/2)%(mylen/2);

		// This is the character we're looking for in the smaller string.
		return solve(newindex);
	}
}
