def main(): y = int(input()) print(2017 - y) if __name__ == '__main__': main()