#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
#define SIZE(x) ll(x.size())
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
const int MAX_N = 10000;
typedef pair<int, int> P;

bool isPrime(int n) {
    bool flag = true;
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            flag = false;
            break;
        }
    }
    return flag;
}

int main()
{
    int N;
    cin >> N;

    vector<int> ans, ct(4);
    set<int> st;
    int last = 3 * 5 * 7 * 11;
    ct[0] = 3;
    ct[1] = 5;
    ct[2] = 7;
    ct[3] = 11;
    for (int i2 = 2; i2 <= MAX_N; i2 += 2) {
        rep(i, 4) {
            int t = i2 * ct[i];
            if (t <= MAX_N) st.insert(t);
        }
    }

    int cnt = 0;
    for (auto i : st) {
        cout << i << " ";
        cnt++;
        if (cnt >= N - 1) break;
    }
    cout << last << endl;
    return 0;
}
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;

bool solve(string s) {

    if(s.size() == 1) return s == "8";

    if(s.size() == 2){
        if(stoi(s) % 8 == 0) return 1;
        swap(s[0], s[1]);
        if(stoi(s) % 8 == 0) return 1;
        return 0;
    } 


    vector<int> cnt(10, 0);

    int n = s.size();

    rep(i,n) cnt[s[i] - '0']++;

    for(int i = 112;i < 1000;i += 8) {
        auto c = cnt;

        for(char j : to_string(i)) c[j - '0']--;

        bool flag  = true;

        for(char j : to_string(i)){
            if(c[j - '0'] < 0) {
                flag = false;
            }
        }


        if(flag) return 1;
    }

    return 0;

}


int main() {
    string s;
    cin >> s;

    string ans;

    solve(s) ? ans = "Yes" : ans = "No";

    cout << ans << endl;


}