n = int(input()) a = [0,7,111,111,3171,161 ] print(a[n])