#include <iostream>
#include <string>
#include <map>
int main() {
std::string num, res, buff;
std::map<std::string, std::string> _822;
_822["0"]= "000";
_822["1"] = "001";
_822["2"] = "010";
_822["3"] = "011";
_822["4"] = "100";
_822["5"] = "101";
_822["6"] = "110";
_822["7"] = "111";
std::cin >> num;
res = "";
for (int i = num.length(); i >= 0; --i) {
buff = num[i];
res = _822[buff] + res;;
}
std::cout << std::endl;
std::cout << res;
std::cin.get(), std::cin.get();
return 0;
}