#include"bits/stdc++.h" using namespace std; int main() { int Y; cin >> Y; cout << 2017-Y << endl; }