def isPrime(N):
  if N == 1:
    return False
  for m in range(2, int(N**0.5) + 1):
    if N % m == 0:
      return False
  return True

count1 = 0
count3 = 0
count7 = 0
count9 = 0
for i in range(1,100000):
  if isPrime(i):
    if isPrime(i) and i % 10 == 1:
      count1 += 1
    if isPrime(i) and i % 10 == 3:
      count3 += 1
    if isPrime(i) and i % 10 == 7:
      count7 += 1
    if isPrime(i) and i % 10 == 9:
      count9 += 1
print(count1, count3, count7, count9)

