#include <stdio.h>

int main(int argc, const char* argv[])
{
	long inputN, FizzBuzzSum = 0, aElement = 0;
	scanf("%ld", &inputN);

	// Looks inside iterator (i) for a number that has division remainder (remainder > 0). Then adds that remainder to FizzBuzzSum
	for (int i = 0; i <= inputN; i++)
	{
		if (i % 3 != 0 && i % 5 != 0)
		{
			FizzBuzzSum += i;
		}
	}

	printf_s("%ld \n", FizzBuzzSum);
}