#include<stdio.h>

int main(void){
    long long int a,b,c,d,e,f;
    scanf("%lld",&a);
   b=a*(a+1)/2;
   c=(a/3)*((a/3)+1)*3/2;
   d=(a/5)*((a/5)+1)*5/2;
   e=(a/15)*((a/15)+1)*15/2;
   f=b-c-d+e;
   printf("%lld %lld %lld %lld\n",b,c,d,e);
   printf("%lld",f);
}