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