#include <stdio.h>

int		main()
{
	int		N;
	int		i;
	long	sum;

	i = 1;
	sum = 0;
	scanf("%d\n", &N);
	while (i <= N)
	{
		if (i % 3 && i % 5)
			sum += (long)i;
		i++;
	}
	printf("%ld\n", sum);
	return (0);
}
