#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int M = 4;
int a[M+1];
bool function(int i){
int a;
while(i){
a = i % 10;
i /= 10;
if(a == 7){
return true;//包含7
}
}
return false;
}
int main(void)
{
int n;//输入的数
int count = 0;//计数
cin >> n;
//初始化
for(int i=0; i<M; i++){
a[i] = 0;
}
for(int j=1; j<=n; j++){
count++;
if(function(j) || (j % 7 == 0)){//满足条件
a[count % 4]++;
n++;//这一步很重要啊!!
}
}
cout << a[1] << endl;
cout << a[2] << endl;
cout << a[3] << endl;
cout << a[0];
return 0;
}
100分