#include<stdio.h>

int main(){
	int N;
	long count =0;
	scanf("%d", &N);
	for(int i=1; i<=N; i++){
		if(i%3==0 && i%5==0){	
		}
		else if(i%3==0){
		}
		else if(i%5==0){
		}
		else{
			count+=i;
		}		
	}
	if(count>1000000){
		printf("%ld\n", count);
		printf("Watch out for overflow.\n");
	}
	else{
		printf("%ld", count);	
	}
	
	return 0;
}