n = gets.chomp.to_i str = "" (n+1).times do |i| str = str + "#{i}" end print str[n].chr