output_description: Print the answer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      K
attempt: def LunLun(k, count, base):
      nx = []
      n = len(base)
      if count + n >= k:
          ans = base[k - count - 1]
          return ans
  
      for x in base:
          count += 1
          p = x % 10
          x *= 10
          a = x + p - 1
          b = a + 1
          c = b + 1
          n = 3
          if p == 0:
              n -= 1
              nx.extend([b, c])
          elif p == 9:
              n -= 1
              nx.extend([a, b])
          else:
              nx.extend([a, b, c])
  
      return LunLun(k, count, nx)
  
  
  def main():
      k = int(input())
      base = range(1, 10)
      ans = LunLun(k, 0, base)
      print(ans)
  
  
  if __name__ == "__main__":
      main()
  
problem_description: Statement
  
  A positive integer X is said to be a lunlun number if and only if the
  following condition is satisfied:
  
    * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.
  
  For example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or
  13579 is.
  
  You are given a positive integer K. Find the K-th smallest lunlun number.
samples: [{"input": "15", "output": "23\n    \n\nWe will list the 15 smallest lunlun numbers in ascending order:  \n1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 21, 22, 23.  \nThus, the answer is 23.\n\n* * *"}, {"input": "1", "output": "1\n    \n\n* * *"}, {"input": "13", "output": "21\n    \n\n* * *"}, {"input": "100000", "output": "3234566667\n    \n\nNote that the answer may not fit into the 32-bit signed integer type."}]