Y = int(raw_input()) print 2017 - Y