N=gets.chomp.to_i def match(n) # 6 => 9 # 5 => 5 # 4 => 4 # 3 => 7 # 2 => 1 # 1 か 7しかない seven = n % 2 == 1 c = (n.to_f / 2).to_i ret = "" for num in 0..c-1 if num == (c-1) and seven ret = "7" + ret else ret = "1" + ret end end return ret end puts match(N)