#include <bits/stdc++.h>
#define ll long long
#define ld long double

using namespace std;

int main()
{
    /*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int qq;
    vector <int> v;

    while(cin >> qq) v.insert(v.end(), qq);

    int n;
    cin >> n;
    cout << n / (rand() % 3 + 2);
/*
    int r = 1, sch = 1;
    bool b;
    while(r < n)
    {
        int t = r;
        while(t > 0)
        {
            b = false;
            int ost = t % 10;
            t /= 10;
            for(int j = 0; j < v.size(); j++)
                if(ost == v[j])
                {
                    b = true;
                    break;
                }
            if(b) break;
        }
        if(b)
            r++;
        else
        {
            r++;
            sch++;
        }
        cout << sch << " ";
    }
    cout << sch;













































*/
    /*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);

    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int qq;
    vector <int> v_nel, v_doc;

    while(cin >> qq) v_nel.insert(v_nel.end(), qq);

    int n;
    cin >> n;

    while(n > 0)
    {
        v_doc.insert(v_doc.end(), n % 10);
        n /= 10;
    }
    sort(v_nel.begin(), v_nel.end());
    int sch = 0;
    for(int i = 0; i < v_doc.size(); i++)
    {
        while(v_doc[i] > 0)
        {
            for(int j = v_nel.size() - 1; j > -1; j--)
                if(v_nel[j] == v_doc[i])
                {
                    v_doc[i]--;
                    sch++;
                    break;
                }
            int s, x, y;
            x = v_doc.size() - 1;
            s = pow(5, x);
            v_doc[i]--;
            sch += s;
            for(int j = v_nel.size() - 1; j > -1; j--)
                if(v_nel[j] == v_doc[i])
                {
                    v_doc[i]--;
                    sch++;
                    break;
                }
        }
    }
    cout << sch;*/
    return 0;
}
