#include <stdio.h>

int		main(void)
{
	double sum = 0;
	unsigned int get;
	unsigned int i = 0;

	scanf("%d", &get);
	if (get > 1000000)
		get = 1000000;
	while (++i <= get)
	{
		if (i % 3 == 0 && i >= 3)
			continue;
		if (i % 5 == 0 && i >= 5)
			continue;
		sum = sum + i;
	}
	printf("%lf\n", sum);
	return (0);
}
