#include<iostream>usingnamespace std;intmain(){int n;
cin >> n;int a =0, b =0, c =0, d =0;// 四个数分别存放甲乙丙丁中各自跳过的数之和int count;for(int i =1,count=1; count < n+1; i++,count++){if(i %4==1){if(i %7==0||(i%10==7|| i/10%10==7|| i /100%10==7|| i /1000%10==7)){
a++;
count--;}}elseif(i %4==2){if(i %7==0||(i %10==7|| i /10%10==7|| i /100%10==7|| i /1000%10==7)){
b++;
count--;}}elseif(i %4==3){if(i %7==0||(i %10==7|| i /10%10==7|| i /100%10==7|| i /1000%10==7)){
c++;
count--;}}else{if(i %7==0||(i %10==7|| i /10%10==7|| i /100%10==7|| i /1000%10==7)){
d++;
count--;}}}
cout << a << endl;
cout << b << endl;
cout << c << endl;
cout << d << endl;return0;}