if __name__ == "__main__": Y = int(input()) print(2017-Y)