#include<stdio.h>

int main(){
    int n;
    long long sum = 0;
    scanf("%d",&n);
    
    for(unsigned int i=1;i<=n;i++){
        if(i%3!=0){
            if(i%5!=0){
                sum += i;
                printf("%d\n",i);
                printf("%d\n",sum);
            }
        }
    }

    return 0;
}