#include <iostream>
#include <string>
using namespace std;
int main()
{
  string S;
  cin >> S;
  for (auto &ch : S)
    if (ch == '6')
      ch = '9';
  	else if (ch == '9')
      ch = '6';
  for (int i = S.length() - 1; i >= 0; i -= 1)
    cout << S[i];
}
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <numeric>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(void) {
	int n;

	cin >> n;

	cout << n / 100 +(n % 100 == 0 ? 0 : 1) << endl;
}