#include <bits/stdc++.h> using namespace std; typedef int64_t lint; int main() { lint y; cin>>y; cout<<2017-y<<endl; // getchar(); // getchar(); }