def base_str(n, radix): digits = "0123456789abcdefghijklmnopqrstuvwxyz" def num_check(attr, i): try: return int(i) except: raise ValueError('invalid %s : %s' % (attr, i)) n = num_check('n', n) radix = num_check('radix', radix) if not 1 < radix < 37: raise ValueError('invalid radix %s' % radix) is_negative = n < 0 n = abs(n) result = [] while n: result.insert(0, n % radix) n /= radix if n == 0: break s = ''. join([digits[i] for i in result]) if is_negative: s = '-' + s return s n=int(raw_input()) print base_str(n,7)