#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <utility>
#include <tuple>
#include <cmath>
#include <numeric>
#include <set>
#include <map>
#include <array>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>
#include <chrono>
#include <valarray>
#include <bitset>
using ll = long long;
using std::cin;
using std::cout;
using std::endl;
std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;


bool check(const std::vector<int> &res, ll n)
{
  ll x = 0, y = 0;
  for(const auto &e : res)
  {
    if(e == 1)
      x += 1;
    if(e == 2)
      y += 1;
    if(e == 3)
      x += y;
    if(e == 4)
      y += x;
    // cout << x <<" "<<y << endl;
  }
  return x == n;
}
void solve()
{
  const int N = 84;
  const int MAX = 1e6;
  std::vector<ll> fibo(N);
  fibo[0] = fibo[1] = 1;
  for (int i = 2; i < N; ++i)
  {
    fibo[i] = fibo[i - 1] + fibo[i - 2];
  }
  ll n; cin >> n;
  auto tn = n;
  std::vector<int> cnt(N), res;
  std::vector<int> dp(MAX, inf), back(MAX, -1);
  dp[0] = 0;
  for (int i = 0; i < MAX; ++i)
  {
    for (int j = 0; j < N; ++j)
    {
      if(i + fibo[j] >= MAX)
        break;
      if(chmin(dp[i + fibo[j]], dp[i] + 1 + j))
      {
        back[i + fibo[j]] = j;
      }
    }
  }
  while(n > 0)
  {
    int id = std::upper_bound(fibo.begin(), fibo.end(), n) - fibo.begin();
    id -= 1;
    if(id == 1)
      id = 0;
    // cout <<"id:"<<id<<endl;
    n -= fibo[id];
    cnt[id] += 1;
  }
  while(n > 0)
  {
    int b = back[n];
    n -= fibo[b];
    cnt[b] += 1;
  }
  int turn = -1;
  ll x = 0, y = 0;
  for(int i = N - 1; i >= 0; i--)
  {
    if(cnt[i] > 0)
    {
      if(turn == -1)
      {
        if(i % 2 == 0)
        {
          turn = 0;
        }
        else
        {
          turn = 1;
        }
      }

      for (int j = 0; j < cnt[i]; ++j)
      {
        if(turn == 0)
        {
          res.emplace_back(1);
          x += 1;
        }
        else
        {
          res.emplace_back(2);
          y += 1;
        }
      }
    }
    if(x == tn)
      break;
    if(turn == 0)
    {
      res.emplace_back(4);
      y += x;
      turn ^= 1;
    }
    else if(turn == 1)
    {
      res.emplace_back(3);
      x += y;
      turn ^= 1;
    }
  }
  if(not check(res, tn))
  {
    cout <<"WA"<<" " << x << " " << y << endl;
  }
  
  cout << res.size() << "\n";

  for (const auto &t : res)
  {
    cout << t << "\n";
  }
  
}

int main()
{
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);


  int kkt = 1;
  // cin >> kkt;
  while(kkt--)
    solve();
  return 0;
}
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ub              upper_bound
#define lb              lower_bound
#define isrt            insert
#define clr             clear
#define rsz             resize
#define ff              first
#define ss              second
#define int             long long int
#define pb              push_back
#define pf              push_front
#define mkp             make_pair
#define mkt             make_tuple
#define pii             pair<int,int>
#define tii             tuple<int,int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int>>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define INF             1e9
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define rall(v)         v.rbegin(),v.rend()
#define endl            "\n"
using cd = complex<double>;
const double PI = acos(-1);
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int maxm(int a, int b)
{
    return (a >= b ? a : b);
}


int minm(int a, int b)
{
    return (a <= b ? a : b);
}

int power(int x, int y, int p)
{
    int res = 1;
    x = x % p;
    if (x == 0)
        return 0;

    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

#define FMAX 1000010
vector<int> fact(FMAX, 1);
vector<int> fact_inv(FMAX, 1);
vector<int> spf(FMAX);

int nCrmodp(int n, int r, int p)
{
    if (r > n)
        return 0;
    int pro = (fact[n] * fact_inv[r]) % p;
    pro = (pro * fact_inv[n - r]) % p;
    return pro;
}
void precompute()
{
    int x = 1;
    for (int i = 1; i < FMAX; ++i)
    {
        x *= i;
        x %= mod;
        fact[i] = x;
        fact_inv[i] = power(x, mod - 2, mod);
    }
}

void spf_calc()
{
    for (int i = 1; i < FMAX; ++i)
        spf[i] = i;

    for (int i = 2; i * i < FMAX; ++i)
        if (spf[i] == i)
            for (int j = i * i; j < FMAX; j += i)
                if (spf[j] == j)
                    spf[j] = i;
}

int next_smaller(vector<int>v, int val)
{
    int l = 0, r = v.size() - 1, ans = -1;
    while (l <= r)
    {
        int mid = (l + r) / 2;
        if (v[mid] <= val)
        {
            ans = mid;
            l = mid + 1;
        }
        else
            r = mid - 1;
    }
    return ans;
}


void c_p_c()
{
    //precompute();
    //spf_calc();
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

signed main()
{
    c_p_c();
    map<int, int>mp;
    mp[0] = 0;
    mp[6] = 9;
    mp[9] = 6;
    mp[1] = 1;
    mp[8] = 8;
    string str;
    cin >> str;
    int  n = str.length();
    for (int i = 0; i < n; ++i)
        cout << mp[str[n - 1 - i] - '0'];
    cout << endl;
    return 0;
}