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