#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <set>
#include <vector>
#include <queue>
#include <map>
#include <numeric>
#include <math.h>
#include <complex>

using namespace std;

#define rep(i, n) for (long long int i = 0; i < (long long int)(n); i++)
#define irep(i, n) for (long long int i = 1; i <= (long long int)(n); i++)
#define drep(i, n, diff) for (long long int i = 0; i < (long long int)(n); i += diff)
#define mod 1000000007
#define INF 1001001001001001011
#define ld(val) printf("%s : %lld\n", #val, val);
#define sd(val) printf("%s : %s\n", #val, val.c_str());

typedef long long int ll;
typedef pair<ll, ll> P;
typedef pair<P, P> PP;
typedef tuple<ll, ll, ll> TP;

int main() {
  string s;
  cin >> s;
  reverse(s.begin(), s.end());
  rep(i, s.size()) {
    if(s[i] == '6') {
      cout << '9';
    } else if(s[i] == '9') {
      cout << '6';
    } else {
      cout << s[i];
    }
  }
  cout << endl;
  return 0;
}
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &x){
	x = 0; int f = 1; char ch = getchar();
	while (!isdigit(ch)) {if (ch == '-') f = -1; ch = getchar();}
	while (isdigit(ch)) {x = x * 10 + ch - '0'; ch = getchar();}
	x *= f;
}
inline void write(int x){if (x > 9) write(x/10); putchar(x%10+'0'); }

#define LL long long

const LL inf = 1000000000000000000ll;
LL fib[150],m,n,nn;
int main(){
	int i;	cin >> n;nn=n;
	fib[0] = 1,fib[1] = 1; m = 1;
	while (fib[m] + fib[m-1] <= n){
		fib[m+1] = fib[m] + fib[m-1];
		++m;
	}
//	cerr<<m<<'\n';

	int ops = 0;
	
	for (i = 0; i <= m; ++i){
		if (i){
			++ops;
		}
		if (fib[m - i] <= n){
			n -= fib[m - i];
			++ops;
		}
	}
	n=nn;
	cout << ops << '\n';
	
	LL x = 0,y = 0;
	for (i = 0; i <= m; ++i){
		if (i){
			if ((m-i-1) & 1) cout << 3 << '\n',x+=y;
			else cout << 4 << '\n',y+=x;
		}
		if (fib[m - i] <= n){
			n -= fib[m - i];
			if ((m-i) & 1) cout << 2 << '\n',++y;
			else cout << 1 << '\n',++x;
		}
	}
//	cerr << "final " << x << ' ' << y << '\n';
	assert(x == nn);
	
	return 0;
}