#include<iostream>
using namespace std;
#include <cmath>
int main(){
    int x;

    while(1){
        int p = 0;
        cin >> x;
        if(x == 0){
            break;
        }
        for (int i= 1; i <= x; i++) {
            int valueDigits = log10(i) + 1;
//            cout << "Case "<< i << "input:" << x << "桁数" << valueDigits  <<endl;
            for (int k = 1; k <= valueDigits; k++) {
                int warukazu = 10 *(k - 1);
                if (warukazu == 0) {
                    warukazu = 1;
                }
                int j = i % warukazu;
                cout << i  <<"watta:" << j << endl;
                if (j == 4 || j == 6) {
//                    cout << "dame:" << i << endl;
                    p++;
                }
            }
        }
        cout << ":" << p << endl;
    }
}