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