#include using namespace std; int main(void) { int y; cin >> y; cout << 2017 - y << endl; return 0; }