#include using namespace std; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); int Y; cin >> Y; cout << 2017 - Y << endl; }