jiahuimbzuai/CoQuIR huggingface dataset:
//  [java]
import java.io.*;
import java.util.*;
class Main{
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int N = saori.saori_hayami();
		int ans = 0;
		boolean flg = false;
		
		for(int i = 1;i <=9;i++){
			if(N % i == 0){
				ans = N/i;
				if(ans < 10){
					flg = true;
				}
			}
		}
		if(flg){
			System.out.println("Yes");
		} else{
			System.out.println("No");
		}
		
		
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}
//  [java]
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {

		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(reader.readLine());
		boolean flag = false;
		outer:
		for (int A = 1; A <= 9; A++) {
			for (int B = 1; B <= 9; B++) {
				if (N == A * B) {
					System.out.println("Yes");
					flag = true;
					break outer;
				}
			}
		}
		if (!flag) {
			System.out.println("No");
		}
	}
}
//  [java]
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean check = false;
		int c = 1;
		for(int i = 1; i<10; i++){

			if(check == false){

				for(int j =c; j <10; j++){

					if(i*j == n){
						check = true;
						break;
					}

				}

			}else{
				break;
			}
		}

		if(check){
			System.out.println("YES");
		}else{
			System.out.println("NO");

		}
		
	}
}
//  [java]
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean check = false;
		for(int i = 1; i<10; i++){
			if(check == false){
				for(int j =1; j <10; j++){
					if(i*j == n){
						check = true;
						break;
					}
				}
			}else{
				break;
			}
		}

		if(check){
			System.out.println("YES");
		}else{
			System.out.println("NO");

		}
		
	}
}
//  [java]
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean check = false;
		for(int i = 1; i<10; i++){
			if(check == false){
				for(int j =1; j <10; j++)
				if(i*j == n){
					check = true;
					break;
				}
			}else{
				break;
			}
		}
		if(check){
			System.out.println("YES");
		}else{
			System.out.println("NO");

		}
		
	}
}
//  [cpp]
#include<stdio.h>

int main()
{ 
int m,flag=0;
    scanf("%d",&m);
    
    for(int i=1;i<=9;i++)
    {for(int j=1;j<=9;j++){
            if(i*j==m)
            {flag=1;break;}
            
        }}
    if(flag==1) printf("Yes");
    else printf("No");
return 0;
}
//  [cpp]
#include <stdio.h>

int main()
{
    int N;
    scanf("%d", &N);
    for(int i=1; i<10; i++){
        for(int j=1; j<10; j++){
            if(i*j == N){
                printf("Yes\n");
                return 0;
            }
        }
    }
    printf("No\n");
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
constexpr int INF = numeric_limits<int>::max();
template <typename T, typename... Args>
const T& min(const T& a, Args... args) {
  return min(a, min(args...));
}
template <typename T, typename... Args>
const T& max(const T& a, Args... args) {
  return max(a, max(args...));
}

#pragma GCC optimize("O3")
static const auto __ = [] {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  return nullptr;
}();

int main(int argc, char* argv[]) {
  int n;
  cin >> n;
  for (int a = 1; a < 10; ++a) {
    for (int b = 1; b< 10; ++b) {
      if (a * b == n) {
        cout << "Yes" << '\n';
        return 0;
      }
    }
  }
  cout << "No" << '\n';
  return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string S;
  cin >> S;
  int A[20];
  int ans = 0;
  int myans =0;
  for (int i=0;i<S.size();i++){
    if(S[i] == 'A' || S[i]=='C' || S[i] =='G' || S[i] =='T'){
      A[i]=1;
    }else{
      A[i]=0;
    }
  }
  for(int i=0;i<=S.size();i++){
    if(A[i]!=0){
      ans++;
    }else{
      myans = max(myans,ans);
      ans=0;
    }
//    cout << S.substr(i,3) << endl;
  }
  cout << myans << endl;
  
  return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  bool flag = false;
  for(int i=1;<10;i++){
    for (int j=1;<10<j++){
      if (i*j == N) flag = true;
    }
  }
  if (flag){
    cout << "Yes";
  }else{
    cout << "No";
  }
  cout << endl;
  
  return 0;
}
//  [cpp]
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

int main(){
  int n;
  cin>>n;
  bool answer=false;
  for(int i=1;i<=9;i++){
    for(int j=1;j<=9;j++){
    	if(n==i*j) anwer=true;
    } 
  }
  if(answer) printf("Yes");
  else printf("No");
}
//  [c]
#include<stdio.h>
int main()
{
    int n,i,j,flag=0;
    scanf("%d",&n);
    for(i=1;i<=9;i++)
    {
        for(j=1;j<=9;j++)
        {
            if(i*j==n)
                flag=1;
        }

    }
    if(flag==1)
    printf("Yes\n");
    else
        printf("No\n");

}
//  [c]
#include <unistd.h>

int main()
{
    char buf[4] = {0};  // 入力バッファ（0で初期化）
    int N = 0;      // 入力された数値

    int len = 0;        // 入力された文字列の長さ
    int rank = 1;       // 位

    // 標準入力から4バイト読み込みバッファに格納
    read(0, buf, 4);

    // 入力された文字列の長さをはかる
    for (int i = 1; i < 4; i++) {
        if (buf[i] != 0) {
            len++;
        }
    }

    // Nに入力された数値を格納
    for (int i = len; i > 0; i--) {
        N += (int)((buf[i-1] - 0x30) * rank);   // 文字'0'はASCIIで0x30のため
        rank = rank * 10;
    }

    // 本題
    for (int i = 1; i < 10; i++) {
        for (int j = 1; j < 10; j++) {
            if (N == (i * j)) {
                write(1, "Yes\n", 4);
                return 0;
            }
        }
    }

    write(1, "No\n", 3);

    return 0;
}
//  [c]
#include <stdio.h>

int main(void)
{
    int n;

    scanf("%d", &n);

    for (int a=1; a<=9; a++) {
        for (int b=1; b<=9; b++) {
            if (a*b==n) {
                printf("Yes");
                return 0;
            }
        }
    }

    printf("No");

    return 0;
}
//  [c]
#include <stdio.h>
int main()
{
    int n;
    scanf("%d",&n);

    if(n==1*1 || n==2*2 || n==3*3 || n==4*4 ||n==5*5 ||n==6*6|| n==7*7||n==8*8||n==9*9)
    {
        printf("Yes");

    }
    else if (n==10||n==20||n==30||n==40)
        {
            printf("Yes");
        }
    else
    {
        printf("No\n");
    }
     return 0;
}
//  [c]
#include<stdio.h>
int main()
{
    int n,i,d,j,l;

    scanf("%d",&n);

    for(i=1;i<=9;i++)
    {
        for(j=1;j<=9;j++)
        {
            if(i*j==n) n=l;

            if(i*j==n) break;

            else continue;

        }
    }

     if(n==l) printf("Yes\n");

     else printf("No\n");


return 0;
}
//  [c]
#include <stdio.h>
int main(){
  int i,a;
  scanf("%d",&a);
  for(i=1;i<=9;i++){
    if(a%i==0){
      puts("Yes");
      return 0;
    }
  }
  puts("No");
  return 0;
}
//  [javascript]
function main(n) {
    for (var i = 1; i <= 9; i++) {
        if (n % i === 0 && n / i < 10) {
            console.log('Yes');
            return;
        }
    }
    console.log('No');
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function main(n) {
    for (var i = 1; i <= 9; i++) {
        if (n % i === 0 && n / i < 10) {
            console.log('Yes');
            process.exit(0);
        }
    }
    console.log('No');
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function main(input){
  input = Number(input);
  
  for(var i = 1;i < 10;i++){
    if(input % i === 0){
      if(input / i < 10){
        console.log("Yes");
        return;
      }
    }
  }
  console.log("No");
}

main(require("fs").readFileSync("/dev/stdin","utf8"));
//  [javascript]
function main(lines) {
 const input = lines.split('\n').map(Number)
 
 let flag = false;
 for(let i=1; i<10; i++){
     if(input[0]%i === 0 && 1<= input[0]/i && input[0]/i <= 9 ){
         flag = true;
         break;
     }
 }
 
 flag ? console.log('Yes') : console.log('No')
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
const input = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");

const N = input[0]

let result = 'No'
for (let i = 1; i <= 9; i++) {
    for (let j = 1; j <= 9; j++) {
        if (i * j == N) {
            result = 'Yes'
        }
    }
}

console.log(result)
//  [javascript]
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

reader.on('close', () => {
 var n = Number(lines[0]);
 for(i=1; i<=9; i++){
   for(j=1 j<=9; j++){
     if(i * j == n){
       console.log(Yes);
     }
   }
 }

 console.log("No");
});
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	m := make(map[int]bool)
	for i := 1; i <= 9; i++ {
		for j := 1; j <= 9; j++ {
			m[i*j] = true
		}
	}

	if m[n] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
)

var mod = 1000000007

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(r, &n)

	ans := "No"
LOOP:
	for i := 1; i <= 9; i++ {
		for j := 1; j <= 9; j++ {
			if i*j == n {
				ans = "Yes"
				break LOOP
			}
		}
	}

	fmt.Println(ans)
}
//  [go]
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	for i := 1; i <= 9; i++ {
		for j := 1; j <= 9; j++ {
			if n == i*j {
				fmt.Println("Yes")
				return
			}
		}
	}

	fmt.Println("No")
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
	"unsafe"
)

func main() {
	N := sc.nextInt()
	if N > 81 {
		no()
		return
	}
	for i := 2; i <= 9; i++ {
		if N%i == 0 {
			if N/i >= 1 && N/i <= 9 {
				yes()
				return
			}
		}
	}
	no()
}

var (
	sc scanner
)

func init() {
	sc = scanner{
		buf: make([]string, 0, 0),
		cur: 0,
		r:   bufio.NewReader(os.Stdin),
	}
}

type scanner struct {
	buf []string
	cur int
	r   *bufio.Reader
}

func (s *scanner) readln() {
	rbuf := make([]byte, 0, 0)
	for {
		line, prefix, err := s.r.ReadLine()
		if err != nil {
			panic(err)
		}
		rbuf = append(rbuf, line...)
		if prefix == false {
			break
		}
	}
	s.cur = 0
	s.buf = strings.Split(*(*string)(unsafe.Pointer(&rbuf)), " ")
}
func (s *scanner) isFull() bool {
	if s.cur == len(s.buf) {
		return true
	}
	return false
}
func (s *scanner) resetCur() {
	s.cur = 0
}
func (s *scanner) next() string {
	if s.cur == 0 {
		s.readln()
	}
	res := s.buf[s.cur]
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nexts() []string {
	s.readln()
	s.resetCur()
	return s.buf
}
func (s *scanner) nextInt() int {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.Atoi(s.buf[s.cur])
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextInts() []int {
	s.readln()
	res := make([]int, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.Atoi(s.buf[i])
	}
	s.resetCur()
	return res
}
func (s *scanner) nextFloat() float64 {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.ParseFloat(s.buf[s.cur],
		64)
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextFloats() []float64 {
	s.readln()
	res := make([]float64, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.ParseFloat(s.buf[i],
			64)
	}
	s.resetCur()
	return res
}
func digits(x int) int {
	return len(strconv.Itoa(x))
}
func powInt(x, p int) (result int) {
	result = 1
	for i := 0; i < p; i++ {
		result *= x
	}
	return
}
func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}
func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}
func abs(x int) int {
	return int(math.Abs(float64(x)))
}
func varDump(value ...interface{}) {
	for _, v := range value {
		fmt.Fprintf(os.Stderr, "%#v\n", v)
	}
}
func yes() {
	fmt.Println("Yes")
}
func no() {
	fmt.Println("No")
}

// Pair a
type Pair struct {
	first  int
	second int
}

// Queue a
type Queue struct {
	v []Pair
}

// Push for queue
func (q *Queue) Push(v Pair) {
	q.v = append(q.v, v)
}

// Pop for queue
func (q *Queue) Pop() Pair {
	r := q.v[0]
	q.v = q.v[1:]
	return r
}

// Front for queue
func (q Queue) Front() Pair {
	return q.v[0]
}

// Empty return true if empty
func (q Queue) Empty() bool {
	return len(q.v) == 0
}
//  [go]
package main

func main() {
	var n int
	fmt.Scan(&n)
	for i := 1; i <= 9; i++ {
		for j := 1; j <= 9; j++ {
			if n == i*j {
				fmt.Println("Yes")
				os.Exit(0)
			}
		}
	}
	fmt.Println("No")
}
//  [go]
package main

import (
  "fmt"
)

func main() {
  var output := "No"
  var n int
  n = fmt.Scan(&n)
  
  var slice [81]int
  for i := 0; i < 10; i++ {
    for j := 0; j < 10; j++ {
      if n == i*j {
        output := "Yes"
      }
    }
  }
  
  fmt.Println(output)
}
//  [ruby]
n = gets.chomp.to_i
result = "No"
10.times do  |i|
  next if i == 0 
  result = "Yes"  if n % i == 0 && n/i <10
end

puts result
//  [ruby]
n = gets.chomp.to_i

1.upto(9) do |i|
  1.upto(9) do |t|
    if i * t == n
      puts 'Yes'
      exit
    end
  end
end
puts 'No'
//  [ruby]
# N, A, B = gets.split(" ").map(&:to_i)
# S = gets.chomp
N = gets.to_i

ok = false
(1..9).each do |x|
    (1..9).each do |y|
        if x*y == N
            ok = true
        end
    end
end

puts ok ? "Yes" : "No"
//  [ruby]
n = gets.to_i
(2..9).to_a.each do |num|
  if n % num == 0 && n / num < 10
    puts "Yes"
    exit
  end
end
puts "No"
//  [ruby]
n = gets.to_i
s = 0
(1..9).each do |x|
  if n%x==0
    if 1<=n%x && 9>=n%x
      s += 1
    end
  end
end
if s != 0
  puts "Yes"
else
  puts "No"
end
//  [ruby]
n = gets.chomp.to_i
arr = []
i = 1
while i <=9
    all = i ** 2
    arr << all
    i += 1
end

arr.each do |j|
    if j == n
        puts "Yes"
        exit
    end
end
//  [rust]
/* {{{ */
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
/* }}} */

fn main() {
    input! {
        n: u32
    }
    for i in 1..10 {
        for j in 1..10 {
            if i * j == n {
                println!("Yes");
                return;
            }
        }
    }
    println!("No");
}
/* vim:set foldmethod=marker: */
//  [rust]
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read bytes") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut ans = "No";
    'outer: for i in 1..10 {
        for j in 1..10 {
            if i * j == n {
                ans = "Yes";
                break 'outer;
            }
        }
    }
    println!("{}", ans);
}
//  [rust]
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let n = v[0];
	let mut flag = false;
	for i in 1..10 {
		for j in 1..10 {
			if i*j == n {
				flag = true;
				break;
			}
		}
	} 
	if flag {
		println!("Yes");
	}else{
		println!("No");
	}
}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
    };

    for i in 1..9{
        if n % i == 0 && n / i <= 9{
            println!("Yes");
            std::process::exit(0);
        }
    }
    println!("No");  
}
//  [rust]
#[allow(unused_imports)]
use std::cmp::max;
#[allow(unused_imports)]
use std::fmt;
#[allow(unused_imports)]
use std::fmt::Debug;
#[allow(unused_imports)]
use std::io;
#[allow(unused_imports)]
use std::str::FromStr;

fn main() {
    let n: i64 = get_vec_input()[0];
    let mut list: Vec<i64> = Vec::new();

    for i in 1..=9 {
        for j in 1..=9 {
            list.push(i * j);
        }
    }

    if list.contains(&n) {
        println!("Yes");
    } else {
        println!("No");
    }
}

#[allow(dead_code)]
fn sum_digit2(value: String) -> u32 {
    return value.chars().fold(0u32, |a, b| a + b.to_digit(10).unwrap());
}

#[allow(dead_code)]
fn sum_digit(value: i64) -> i64 {
    if value < 10 {
        return value;
    }
    return sum_digit(value / 10) + value % 10;
}

#[allow(dead_code)]
fn update_max<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left < right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn update_min<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left > right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn get_vec_input<T>() -> Vec<T>
where
    T: FromStr,
    T::Err: Debug,
{
    let mut input = String::new();
    io::stdin()
        .read_line(&mut input)
        .expect("Failed to read line");
    let vec: Vec<T> = input
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    vec
}

#[allow(dead_code)]
fn get_tuple_input() -> (u64, f32) {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    let mut iter = s.trim().split_whitespace();
    let c: u64 = iter.next().unwrap().parse().unwrap();
    let n: f32 = iter.next().unwrap().parse().unwrap();
    (c, n)
}

#[allow(dead_code)]
fn get_string_input() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    s.trim().to_string()
}
//  [rust]
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn f(s: &[char]) -> bool {
    let m = s.len();
    for i in 0..m {
        if s[i] != s[m - 1 - i] {
            return false;
        }
    }
    true
}

use std::iter::Iterator;

fn main() {
    input! {
        n:usize,
    }

    let mut ans = false;

    for elem in 1..=9 {
        if n / elem < 10 {
            ans = true;
        }
    }

    if ans {
        println!("Yes")
    }else{
        println!("No")
    }

}
//  [swift]
import Foundation

let input:String = readLine()!
let n = Int(input)!

let array = [11, 13, 17, 19, 22, 23, 26, 29, 31, 33, 34, 37, 38, 39, 41, 43, 44, 46, 47, 50, 51, 52, 53, 55, 57, 58, 59, 60, 61, 62, 63, 65, 66, 67, 68, 69, 70, 71, 73, 74, 75, 76, 77, 78, 79, 80, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]
let answer = array.filter{ $0 == n }

if answer == [] {
  print("Yes")
} else {
  print("No")
}
//  [swift]
let input_line = readLine()!.characters.split{$0==" "}.map { Int(String($0))! }
let n = input_line[0]
let canCalcTakahashi = !((1...9).map { n % $0 == 0 && n / $0 < 10 }.filter { $0 }.isEmpty)
print(canCalcTakahashi ? "Yes" : "No")
//  [swift]
let n=Int(readLine()!)!
var judge=0
for i in 1...9{
  for j in 1...9{
    if i*j==n{
      judge=1
    }
  }
}
if judge==1 {
  print("Yes")
}else{
  print("No")
}
//  [swift]
let n=Int(readLine()!)!
var judge=0
for i in 1...9{
  for j in 1...9{
    if i*j==n{
      judge=1
    }
  }
}
if judge==1 {
  print("Yes")
}else{
  print("N0")
}
//  [swift]
var N = (Int)(readLine()!)!
var ans : String  = "No"
for i in 1 ... 9{
  for j in 1 ... 9{
    if i == j {
      ans = "Yes"
    }
  }
}

print(ans)
//  [swift]
let input_line = readLine()!.characters.split{$0==" "}.map { Int(String($0))! }
let n = input_line[0]
var canCalcTakahashi = (1...9).map { n % $0 == 0 && n / $0 < 10 }.isEmpty
print(canCalcTakahashi ? "Yes" : "No")
//  [typescript]
function main(input: string[]): void {
    const n = shi(input);
    let res = false;
    for (let i = 1; i < 10; i++) {
        if (n % i == 0 && n / i < 10) {
            res = true;
            break;
        }
    }
    puts(res ? 'Yes' : 'No');

}

// === BEGIN MODULE ===
function shi(array: string[]): number {
    return parseInt(array.shift());
}
function shf(array: string[]): number {
    return parseFloat(array.shift());
}
function puts(...message: any[]): void {
    process.stdout.write(message.join(' ') + '\n');
}
// === END   MODULE ===

import { readFileSync } from 'fs';
if (process.argv[1] == __filename) {
    const path = process.argv[2] || '/dev/stdin';
    const input = readFileSync(path, 'utf-8');
    main(input.split(/\s+/));
}
//  [typescript]
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [n]: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    for (let i = 1; i <= 9; i++) {
      if (n % i == 0) {
        let t = n / i;
        if (1 <= t && t <= 9) {
          return "Yes";
        }
      }
    }
    return `No`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));
//  [typescript]
const fs = require('fs');
const input = fs.readFileSync('/dev/stdin', 'utf-8');
const N = parseInt(input);

for (let i = 1; i <= 9; ++i) {
  if (N % i !== 0) {
    continue;
  }
  if (N / i <= 9) {
    console.log('Yes');
    return;
  }
}
    
console.log('No');
//  [typescript]
'use strict'
function main(input: String) {
    console.log(parseInt(input, 10) <= 81 ? "Yes" : "No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
function main(e){const r=parseInt(e),n=Math.sqrt(r);if(2===r)return"Yes";if(n>=10)return"No";if(Number.isInteger(n))return"Yes";const t=[];for(let e=2;e<r&&e<10;e++){r%e||t.push(e)}return t.some(e=>t.some(n=>{if(e*n===r)return!0}))?"Yes":"No"}console.log(main(require("fs").readFileSync("/dev/stdin","utf8")));
//  [typescript]
function main(e){const r=parseInt(e),n=Math.sqrt(r);if(n>=10)return"No";if(Number.isInteger(n))return"Yes";const t=[];for(let e=2;e<r&&e<10;e++){r%e||t.push(e)}return t.some(e=>t.some(n=>{if(e*n===r)return!0}))?"Yes":"No"}console.log(main(require("fs").readFileSync("/dev/stdin","utf8")));
//  [python]
K = int(input())
start = 1

DP = [[1 for i in range(10)] for j in range(12)]

# 下からの桁数
for j in range(1, 12):
    # その位の数
    for i in range(10):
        DP[j][i] = DP[j-1][i]
        if i != 0:
            DP[j][i] += DP[j-1][i-1]
        if i != 9:
            DP[j][i] += DP[j-1][i+1]
s = 0
# 後ろから考える
res = ""
for j in range(12):
    for i in range(1, 10):
        prev = s
        s += DP[j][i]
        if s >= K:
            res += str(i)
            # print(i, j)
            break
    if s >= K:
        break

top = i
keta = j
sa = K - prev
for k in range(keta-1, -1, -1):
    t = 0
    for j in range(max(0, top-1), min(9, top+1)+1):
        # print("kj", k, j)
        t_prev = t
        t += DP[k][j]
        if t >= sa:
            res += str(j)
            sa -= t_prev
            top = j
            break
print(res)
//  [python]
K = int(input())

if K <= 9:
    print(K)
    exit()

memo = [[1]*10] + [[1]*10 for _ in range(9)]

n = 9
digit = 1
i = -1
ans = []
while True:
    i += 1
    if i == 10:
        i = 0
        digit += 1
    tmp = memo[digit-1][i]
    if i >= 1:
        tmp += memo[digit-1][i-1]
    if i <= 8:
        tmp += memo[digit-1][i+1]
    memo[digit][i] = tmp
    if i != 0:
        if n + tmp >= K:
            while digit >= 0:
                t = memo[digit][i]
                #if n + t == K:
                #    ans.append(i)
                #    for d in range(digit):
                #        ans.append(min(9, i+d))
                #    break
                if n + t >=  K:
                    ans.append(i)
                    digit -= 1
                    i = max(0, i-1)
                else:
                    n += t
                    i += 1
            break
        else:
            n += tmp

print(''.join(map(str, ans)))
//  [python]
def main():
    k = int(input())
    d = dict()

    # 2 ** 20 = 10 ** 6
    order = 0
    find = False
    for n_digit in range(1, 20):
        # print('(n_digit, order):', n_digit, order)
        if n_digit == 1:
            for i in range(10):
                d[(n_digit, i)] = 1
            
        else:
            for i in range(10):
                d[(n_digit, i)] = d[(n_digit - 1, i)]
                if i >= 1:
                    d[(n_digit, i)] += d[(n_digit - 1, i - 1)]
                if i <= 8:
                    d[(n_digit, i)] += d[(n_digit - 1, i + 1)]

        for i in range(1, 10):
            if order + d[(n_digit, i)] < k:
                order += d[(n_digit, i)]
            else:
                find = True
            
            if find:
                break

        if find:
            break

    # n_digit, start with i
    ans = list()
    ans.append(i)

    for digit in range(n_digit - 1, 0, -1):
        for j in range(i - 1, i + 2):
            if 0 <= j <= 9:
                if order + d[(digit, j)] < k:
                    order += d[(digit, j)]
                else:
                    ans.append(j)
                    i = j
                    break

    print(''.join(map(str, ans)))


main()
//  [python]
from collections import deque
K = int(input())
queue = deque([1,2,3,4,5,6,7,8,9])
count = 1
while count <= K:
  num = queue.popleft()
  if num%10!=0:
    queue.append(num*10+num%10-1)
  queue.append(num*10+num%10)
  if num%!=9:
    queue.append(num*10+num%10+1)
  
print(num)
//  [python]
from collections import deque

K = int(input())

count = 0
ans = 0
Q = deque([1,2,3,4,5,6,7,8,9])
while count != K:
  a = Q.popleft()
  b = a%10
  if b != 0:
    Q.append(q*10 + b - 1)
  Q.append(q*10)
  if b != 9:
    Q.append(q*10 + b + 1)
  count += 1
  ans = q
print(q)
//  [python]
from collections import deque

K = int(input())
q = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])

for i in range(K):
    runrun = q.popleft()
    rem = runrun % 10
    if rem == 0:
        q.append(runrun * 10)
        q.append(runrun * 10 + rem + 1)
    elif rem == 9:
        q.append(runrun * 10 + rem - 1)
        q.append(runrun * 10)
    else:
        q.append(runrun * 10 + rem - 1)
        q.append(runrun * 10)
        q.append(runrun * 10 + rem + 1)

print(runrun)
//  [java]
import java.io.*;
import java.util.*;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int k = Integer.parseInt(br.readLine());
        if(k < 10)
            System.out.println(k);
        else {
            Sol sol = new Sol(k);
            sol.preComp();
        }
    }
}

class Sol {
    long[][] pre;
    int k, l;
    Stack<Integer> res;
    
    Sol(int k){
        this.k = k;
        this.l = 12;
        pre = new long[l][11];
        res = new Stack<>();
    }
    
    void preComp(){
       // base
       for(int dig = 0; dig < 10; ++dig){
           pre[1][dig] = 1;
       }
       pre[1][10] = 9;
       
       int stLen = 0;
       long globSum = 9;
       boolean esc = false;
       
       // rest
       for(int len = 2; len < l; ++len){
           for(int dig = 0; dig < 10; ++dig){
               for(int st = -1; st < 2; ++st){
                    int newDig= dig+st;
                    if(newDig < 0 || newDig > 9)
                        continue;
                    pre[len][dig] += pre[len-1][newDig]; 
               }
               long val = pre[len][dig];
               if(dig != 0){
                   globSum += val;
                   if(globSum >= k){
                       k -= (globSum-val);
                       stLen = len-1;
                       res.add(dig);
                       esc = true;
                       break;
                   }
               }
           }
           if(esc)
                break;
       }
        search(stLen,res.peek());
        StringBuilder sb = new StringBuilder();
        for(int el : res)
            sb.append(el);
        System.out.println(sb);
    }
    
    void search(int len, int currDig){
        if(len==0)
            return;
        
        if(k == 1 && currDig == 1){
            while(len-->0)
                res.add(0);
            return;
        }
        long tSum = 0;
        for(int st = -1; st < 2; ++st){
            int newDig = currDig+st;
            if(newDig < 0 || newDig > 9)
                continue;
            tSum += pre[len][newDig];
            if(tSum >= k){
                res.add(newDig);
                k -= (tSum - pre[len][newDig]);
                search(len-1, newDig);
                break;
            }
        }
    }
}
//  [java]
import java.util.*;
import java.io.*;

public class Main {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    // this should be DP Frog.
    // we aslo can use queue
    // Lunlun Number abcde
    // we can build from abcd

    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
 
        // useQueue();
        useDP();
    }
    public static void useDP() throws IOException {
        int K = nextInt();
        
        long dp[] = new long[3*K+1]; //max
   
        for (int x=1; x<10; x++) {
            dp[x] = x;
        }

        int index = 10;
        for (int x=1; x<=K; x++) {
            long cur = dp[x];
            long mod = cur % 10;
            if(mod != 0){
                dp[index] = 10*cur+mod-1;
                index++;
                if(index>K){break;}
            }
            dp[index] = 10*cur+mod;
            index++;
            if(index>K){break;}
            if(mod != 9){
                dp[index] = 10*cur+mod+1;
                index++;
                if(index>K){break;}
            }
        }

        System.out.println(dp[K]); 
    }

    public static void useQueue() throws IOException {
        int K = nextInt();
        
        LinkedList<Long> queue = new LinkedList<Long>();

        for (int x=1; x<10; x++) {
            queue.add((long)x);
        }

        for (int x=1; x<K; x++) {
            long cur = queue.poll();
            long mod = cur % 10;
            if(mod != 0){
                queue.add(10*cur+mod-1);
            }
            queue.add(10*cur+mod);
            if(mod != 9){
                queue.add(10*cur+mod+1);
            }
        }

        System.out.println(queue.poll()); 
    }
 

    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}
//  [java]
import java.util.*; 
import java.io.*;
 
public class Main {
	
	public static void solve(InputReader in) {
		int n = in.readInt();
		Queue<Long> q = new LinkedList<>();
		ArrayList<Long> list = new ArrayList<>(); 
		for(int i = 1; i<=9; i++) {
			q.add(i); 
			list.add(i);
		}
		 
		for(int i = 0; true; i++) {
		   int x = q.poll(); 
		   int y = 0;
		   if(x % 10 != 0) {
			   y = 10 * x + (x%10) -1;
			   q.add(y);
			   list.add(y); 
		   }
		   y = 10*x + (x%10);
		   q.add(y); 
		   list.add(y); 
		   
		   if(x % 10 != 9) {
			   y = 10*x + (x%10) + 1;
			   q.add(y);
			   list.add(y); 
		   }
		  
		   if(n <= q.size()) {
			   System.out.println(list.get(n-1)); 
			   return; 
		   }
		}
	}
	
	
    public static void main(String[] args) {
    	InputReader in = new InputReader(System.in); 
    	int t = 1;
    	while(t-- > 0) {
    		solve(in); 
    	}
    }
}

class InputReader{
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	 public InputReader(InputStream stream) {
		this.stream = stream;
	}

     public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

     public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

     public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

     public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
     public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}
     
     public String next() {
		return readString();
	}
    
     public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}
//  [cpp]
#include <cstdio>

int n;
int f[15][15];

int main() {
    scanf("%d", &n);
    for (int i = 0; i <= 9; ++i) f[1][i] = 1;
    for (int i = 2; i <= 10; ++i)
        for (int j = 0; j <= 9; ++j) {
            if (!j) f[i][j] = f[i - 1][0] + f[i - 1][1];
            else if (j == 9) f[i][j] = f[i - 1][8] + f[i - 1][9];
            else f[i][j] = f[i - 1][j - 1] + f[i - 1][j] + f[i - 1][j + 1];
        }
    int sum = 0, ok = 0, cnt, now;
    for (int i = 1; i <= 10; ++i) {
        for (int j = 1; j <= 9; ++j) {
            if (sum + f[i][j] >= n) {
                printf("%d", j);
                n -= sum;
                now = j;
                ok = 1;
            }
            if (ok) break;
            sum += f[i][j];
        }
        if (ok) {
            cnt = i;
            break;
        }
    }
    for (int i = cnt - 1; i; --i) {
        sum = 0;
        if (now) {
            if (sum + f[i][now - 1] >= n) {
                printf("%d", --now);
                n -= sum;
                continue;
            }
            sum += f[i][now - 1];
        }
        if (sum  + f[i][now] >= n) {
            printf("%d", now);
            n -= sum;
            continue;
        }
        sum += f[i][now];
        if (now != 9) {
            if (sum + f[i][now + 1] >= n) {
                printf("%d", ++now);
                n -= sum;
                continue;
            }
            sum += f[i][now + 1];
        }
    }
    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
inline int read(){
	char c=getchar();int t=0,f=1;
	while((!isdigit(c))&&(c!=EOF)){if(c=='-')f=-1;c=getchar();}
	while((isdigit(c))&&(c!=EOF)){t=(t<<3)+(t<<1)+(c^48);c=getchar();}
	return t*f;
}
int f[15][10][10],k,out[15],sum[15],pre[15][11];
signed main(){
	k=read();
	for(int i=0;i<=9;i++){
		f[1][i][i]=1;
		pre[1][i]=1;
	}
	sum[1]=9;
	for(int i=2;i<=11;i++){
		for(int j=0;j<=9;j++){
			for(int k=0;k<=9;k++){
				if(k>0)
				f[i][j][k]+=f[i-1][j][k-1];
				if(k<9)
				f[i][j][k]+=f[i-1][j][k+1];
				f[i][j][k]+=f[i-1][j][k];
				pre[i][j]+=f[i][j][k];
			}
			if(j!=0)
			sum[i]+=pre[i][j];
		}
		sum[i]+=sum[i-1];
		//printf("%d %d\n",sum[i],i);
	}
	for(int i=11;i>=1;i--){
		if(sum[i-1]>=k){
			continue;
		}
		k=k-sum[i-1];
		int alfa=0;
		for(int j=1;j<=9;j++){
			alfa+=pre[i][j];
			if(alfa>=k){
				alfa=alfa-pre[i][j];
				k=k-alfa;
				//printf("%d\n",k);
				out[i]=j;
				int len=i-1;
				while(len){
					alfa=0;
					//printf("%d %d\n",max(out[len+1]-1,0),min(out[len+1]+1,9));
					for(int v=max(out[len+1]-1,0);v<=min(out[len+1]+1,9);v++){
						alfa+=pre[len][v];
						if(k<=alfa){
							alfa-=pre[len][v];
							out[len]=v;
							k-=alfa;
							break;
						}
					}
					//printf("%d %d\n",k,alfa);
					len--;
				}
				break;
			}
		}
		break;
	}
	int flag=1;
	for(int i=10;i>=1;i--){
		if(flag&&(!out[i]))continue;
		flag=0;
		printf("%d",out[i]);
	}
	puts("");
	return 0;
}
//  [cpp]
#include<bits/stdc++.h>

typedef long long ll;
typedef std::pair<ll, ll> P;
typedef std::tuple<ll, ll, ll> t3;
constexpr ll INF = 1e15;
constexpr ll mod = 1e9+7;

#define rep(i,n) for(int i = 0; i < int(n); i++)
using namespace std;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }


class Divisor {
private:
	vector<ll> F;
public:
	Divisor(ll N) {
		for (ll i = 1; i * i <= N; i++) {
			if (N % i == 0) {
				F.push_back(i);
				if (i * i != N) F.push_back(N / i);
			}
		}
		sort(begin(F), end(F));
	}
	int size() { return F.size(); }
	ll operator[](int k) { return F[k]; }
	const vector<ll>& factors() { return F; }
};

int main() {
	ll k;
	cin >> k;
	vector<vector<ll>> dp(k, vector<ll>(10, 0));
	rep(i, 10) {
		dp[k - 1][i] = 1;
	}
	for (int i = k - 2; i >= 0; i--) {
		rep(j, 10) {
			for (int a : {-1, 0, 1}) {
				ll id = a + j;
				if (id < 0 || id > 9) continue;
				dp[i][j] += dp[i + 1][id];
				chmin(dp[i][j], INF);
			}
		}
	}
	vector<int> ans;
	int front = -1;
	ll prev = 0;
	int digit = 1;
	for (; digit < k; digit++) {
		for (int j = 1; j < 10; j++) {
			ll next = dp[k - digit][j];
			if (prev + next >= k) {
				ans.push_back(j);
				front = j;
				break;
			}
			prev += next;
		}
		if (front >= 0) break;
	}
	for (int i = k - digit + 1; i < k; i++) {
		for (int a : {-1, 0, 1}) {
			ll j = a + front;
			if (j < 0 || j > 9) continue;
			ll next = dp[i][j];
			if (prev + next >= k) {
				ans.push_back(j);
				front = j;
				break;
			}
			prev += next;
		}
	}
	bool init = false;
	for (int i = 0; i < ans.size(); i++) {
		if (ans[i] != 0) {
			init = true;
			cout << ans[i];
		}
		else {
			if (init) {
				cout << ans[i];
			}
		}
	}
	cout << endl;
	return 0;
}
//  [cpp]
#include <bits/stdc++.h>

#define ll long long
#define ii pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000007
#define loo 0x7fffffffffffffff

#define prime 1000000007
#define mod 1000000007
ll powmod(ll a,ll b) {ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    vector<ll> v {1, 2, 3, 4, 5, 6, 7, 8, 9};
    int k; cin >> k;
    int at = 0;
    while((int)v.size() < k){
        vl aux;
        for(int i = at; i < (int)v.size(); i++){
            ll l = v[i];
            if(l%10LL == 0LL){
                aux.pb(l*10LL+1LL);
                if((int)v.size()+(int)aux.size() == k) break;
                aux.pb(l*10LL);
                if((int)v.size()+(int)aux.size() == k) break;
            }
            else if(l%10LL == 9){
                aux.pb(l*10LL+8);
                if((int)v.size()+(int)aux.size() == k) break;
                aux.pb(l*10LL+9);
                if((int)v.size()+(int)aux.size() == k) break;
            }
            else{
                aux.pb(l*10LL+(l%10LL-1));
                if((int)v.size()+(int)aux.size() == k) break;
                aux.pb(l*10LL+(l%10LL));
                if((int)v.size()+(int)aux.size() == k) break;
                aux.pb(l*10LL+(l%10LL+1));
                if((int)v.size()+(int)aux.size() == k) break;
            }
        }
        at = (int)v.size();
        for(auto l : aux){
            v.pb(l);
        }
        sort(v.begin(), v.end());
    }

    cout << v[k-1] << "\n";

    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#define ss second
#define ff first
#define all(x) x.begin(), x.end()
 
// #define DEBUG 100
 
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll >;
 
const ll oo = 1e18 + 7;
const ll mod = 1e9 + 7,maxn = 1e5 + 100, maxm = 1e5+100;
const double PI = acos(-1);
vector<ll> primo; 
bitset<maxn> np(0);

bool che(string s){
    for (int i=0; i<(int)s.size() - 1; i++){
        if (abs(s[i] - s[i+1]) > 1) return false;
    }
    return true;
}

int main (){
    ios_base::sync_with_stdio(false);
    int n, i = 1;
    cin >> n;

    vector<string> vs;
    while ((int) vs.size() < n){
        string s = to_string(i);
        if (che(s)) vs.push_back(s);
        i++;
    }

    cout << vs.back() << endl;
    return 0;
}
//  [c]
#include<stdio.h>
int k,i,e=10;
long long r[100001];
int main(){
    scanf("%d",&k);
    for(i=1;i<10;i++)r[i]=i;
    for(i=1;i<k;i++){
        if(e>100000)continue;
        if(r[i]%10!=0){
            r[e]=10*r[i]+r[i]%10-1;
            e++;
        }
        r[e]=10*r[i]+r[i]%10;
        e++;
        if(r[i]%10!=9){
            r[e]=10*r[i]+r[i]%10+1;
            e++;
        }
    }
    printf("%lld",r[i]);
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
typedef long long ll;

int main(void){
  ll K,n=100000,ans=0;
  scanf("%lld",&K);
  ll q[n];
  for(ll i=0;i<=8;i++) q[i]=i+1;
  ll head=0,tail=8,tmp=0,flag=0;
  while(K>0){
    ans=q[head];
    head=(head+1)%n;
    tmp=ans%10;
    if(flag==0){
    if(tmp>0){
      tail=(tail+1)%n;
      q[tail]=10*ans+tmp-1;
    }
    tail=(tail+1)%n;
    q[tail]=10*ans+tmp;
    if(tmp<9){
      tail=(tail+1)%n;
      q[tail]=10*ans+tmp+1;
    }
    if(tail<8) flag=1;
    }
    K--;
  }
  printf("%lld",ans);
  
}
//  [c]
#include <stdio.h>
#define true 1
#define false 0

int loop(long int a);
int abs(int a);

int main(void)
{
    int k=0,count=0;
    long int ans=0,i=1;
    scanf("%d",&k);

    while(true){
        if(loop(i)==true){
            ans=i;
            count+=1;
            if(count==k) break;
        }
        i++;
    }
    printf("%ld",ans);
}

int loop(long int a){
    int right=0,left=0;
    int flag=true;
    while(true){
        if(a-10<0) break;
        right=a%10;
        left=(a/10)%10;
        if(abs(right-left)<=1){
            a=a/10;
            loop(a);
        } else {
            flag=false;
            break;
        }
    }
    return flag;
}

int abs(int a){
    if(a<0) a=(-1)*a;
    return a;
}