//  [javascript]
/*!
 * path: atcoder/abc161/d
 * URL: https://github.com/koukimetal/procomvis/tree/master/src/contest/atcoder/abc161/d
 */!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var o=r(n(1)),u=n(2);o.default.readFile("/dev/stdin","utf8",(function(e,t){!function(e){var t=new u.Solver,n=t.parse(e),r=t.solve(n);t.print(r)}(t)}))},function(e,t){e.exports=require("fs")},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});t.__esModule=!0;var u=n(3),i=n(4);function a(e,t){if(e.num.length===t){var n=new Array(e.num.length+1);n.fill(0),n[n.length-1]=1,e.num=n}else e.num.length-1===t?9===e.num[t]?a(e,t+1):e.num[t]++:e.num[t]<9&&Math.abs(e.num[t]+1-e.num[t+1])<=1?e.num[t]++:(a(e,t+1),e.num[t]=Math.max(0,e.num[t+1]-1))}var l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.solve=function(e){for(var t=e.K,n={num:[]},r=0;r<t;r++)a(n,0);return{answer:n.num}},t.prototype.parse=function(e){return{K:i.getSpaceIterator(e,(function(e){return parseInt(e)})).next().value}},t.prototype.print=function(e){var t=e.answer.reverse().join("");console.log(t)},t}(u.SolverBase);t.Solver=l},function(e,t,n){"use strict";t.__esModule=!0;var r=function(){};t.SolverBase=r},function(e,t,n){"use strict";var r=this&&this.__generator||function(e,t){var n,r,o,u,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function a(u){return function(a){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}};t.__esModule=!0,t.getSpaceIterator=function(e,t){var n,o;return r(this,(function(r){switch(r.label){case 0:n=0,o=e.split(/\s+/).map((function(e){return t(e)})),r.label=1;case 1:return n<o.length?[4,o[n]]:[3,4];case 2:r.sent(),r.label=3;case 3:return n++,[3,1];case 4:return[2,void 0]}}))}}]);