function main(input) {
  var answer = 0;
  var input = input.split('\n');
  var str_input = input[0];
  for (var i = 1; i <= 5000000000000000; i++) {
    var new_input = '';
    for (var j = 0; j < str_input.length; j++) {
      var str_number = str_input[j];
      for (var k = 0; k < parseInt(str_number); k++) {
        new_input += str_number;
      }
      str_input = new_input;
    }
  }

  answer = str_input[input[1]];

  console.log(parseInt(answer));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
