n = input() a = -10000 while 1: a += 1 b = a + n a = b - n if str(a).find('7') > 0: continue if str(b).find('7') > 0: continue break print a, b