number=gets.to_i def create_number(_counter) sum=0.to_i _counter.times do|i| sum+=10**i end return sum end puts (number%2==1)? create_number(number/2-1)+7 : create_number(number/2)