import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] people = new int[]{0, 0, 0, 0};
int now = 1;
int tot = 0;
int who = 0;
while(tot != n){
if(contain(now)){
people[who]++;
}else{
tot++;
}
now++;
who = (who + 1) % 4;
}
for (int num : people){
System.out.println(num);
}
}
public static boolean contain(int n){
if(n % 7 == 0) return true;
return String.valueOf(n).indexOf('7') != -1;
}
}