package Yukicoder /** * Created by hichikawa on 2015/11/02. */ fun main(args: Array) { fun readLineLongArray() : List { val str = readLine() as String val arrStr = str.split(" ") val ret = arrStr.map { it.toLong() } return ret } fun readLineLong() : Long { val str = readLine() as String return str.toLong() } fun readLineStringArray() : List { val str = readLine() as String val arrStr = str.split(" ") return arrStr } fun isInclude35(num : Long) : Boolean { if (num == 0.toLong()) return true else if (num % 10 == 3.toLong() || num % 10 == 5.toLong()) return isInclude35(num / 10) else return false } var index = readLineLong() var num : Long = 555 while (index > 1) { num += 30 if (isInclude35(num/10)) { index-- } } println(num) }