#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using pii = pair<int, int>;

/* [💭] [💡] [🎈] */

ll fibo[88];
bitset<88> f;

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

#ifdef _SHIFTPSH
    freopen("_run/in.txt", "r", stdin), freopen("_run/out.txt", "w", stdout);
#endif

    ll n;
    cin >> n;

    ll tn = n;

    fibo[0] = fibo[1] = 1;
    for (int i = 2; i <= 87; i++) fibo[i] = fibo[i - 1] + fibo[i - 2];

    vector<int> v;
    while (n) {
        int i = upper_bound(fibo, fibo + 88, n) - fibo - 1;
        v.emplace_back(i);
        n -= fibo[i];
    }

    int m = v[0];
    for (int i = 1; i < v.size(); i++) f[m - v[i]] = true;

    vector<int> ops;
    ops.emplace_back(1), ops.emplace_back(2);

    ll x = 0, y = 0;
    x++;
    y++;
    for (int i = 1; i < m; i++) {
        if (i & 1) {
            x += y;
            ops.emplace_back(3);
        } else {
            y += x;
            ops.emplace_back(4);
        }
        if (f[i + 1]) {
            if (i & 1) {
                x++;
                ops.emplace_back(1);
            } else {
                y++;
                ops.emplace_back(2);
            }
        }
    }

    cout << ops.size() << '\n';
    for (int o:ops) {
        if (x == tn) {
            cout << o << '\n';
        } else {
            cout << ((o - 1) ^ 1) + 1 << '\n';
        }
    }

    return 0;
}
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define pii pair<int,int>
#define piii pair<int,pii>
#define sp " "
#define nl "\n"
#define all(x) x.begin(),x.end()
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);
#define ll long long
 
using namespace std;
 
const int N = 2e5+5;
const ll INF = 1e18+5;
const int mod = 1e9+7;

int n;
string s;
map<int,int> m;

signed main(){
    #ifndef ONLINE_JUDGE
        freopen("in.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
    fastio()
    cin >> s;
    n=s.size();
    for(int i=0;i<n;i++){
        m[s[i]-'0']++;
    }
    if(n==1){
        cout << (s[0]=='8'||s[0]=='0'?"Yes\n":"No\n");
        return 0;
    }
    if(n==2){
        if(((s[0]-'0')*10+s[1]-'0')%8==0||((s[1]-'0')*10+s[0]-'0')%8==0)
            cout << "Yes\n";
        else
            cout << "No\n";
        return 0;
    }
    for(int i=104;i<1000;i+=8){
        int a=i/100;
        int b=i/10-a*10;
        int c=i%10;
        // cout << a << b << c << nl;
        if(a==b&&a==c){
            if(m[a]>=3){
                cout << "Yes";
                return 0;
            }
        }
        else if(a==b){
            if(m[a]>=2&&m[c]>=1){
                cout << "Yes";
                return 0;
            }
        }
        else if(a==c){
            if(m[a]>=2&&m[b]>=1){
                cout << "Yes";
                return 0;
            }
        }
        else if(b==c){
            if(m[b]>=2&&m[a]>=1){
                cout << "Yes";
                return 0;
            }
        }
        else{
            if(m[a]>=1&&m[b]>=1&&m[c]>=1){
                cout << "Yes";
                return 0;
            }
        }
    }
    cout << (m[0]>=3?"Yes\n":"No\n");
}