#include <iostream>
using namespace std;
int flag[4];
bool check(int x){
if(x % 7 == 0) return false;
while(x){
if(x % 10 == 7) return false;
x /= 10;
}
return true;
}
int main(){
int n; cin >> n;
int cnt = 1, per = 0;
int time = 1;
while(time <= n){
if(check(cnt)) time ++ ;
else flag[per] ++ ;
per = (per + 1) % 4;
cnt ++ ;
}
for(int i = 0; i < 4; i ++ ) cout << flag[i] << endl;
return 0;
}