#include<iostream>
int main(){
  int n;
  std::cin >> n;
  std::cout<<2017-n<<"\n";
  return 0;
}