import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int a = 0, b = 0, c = 0, d = 0, cnt = 0, i;
int n = input.nextInt();
for (i = 1; ; i++) {
int tmp = i;
int flag = 0;
while (tmp != 0) {
if (tmp % 10 == 7) {
flag = 1;
break;
}
tmp /= 10;
}
if (i % 7 == 0 || flag == 1) {
if (i % 4 == 1)
a++;
else if (i % 4 == 2)
b++;
else if (i % 4 == 3)
c++;
else
d++;
}
if (flag == 0 && i % 7 != 0)
cnt++;
if (cnt == n)
break;
}
System.out.println(a);
System.out.println(b);
System.out.println(c);
System.out.println(d);
}
}