#include using namespace std; int main(int argc, char *argv[]) { int y; cin >> y; cout << (2017 - y) << endl; return 0; }