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