#include<stdio.h>
#include<iostream>
using namespace std;
 
int main()
{
    long N;
  	long sum;

 	sum=(1+N)*N/2 + (3+(N/3)*3)*(N/3)/2+ (5+(N/5)*5)*(N/5)/2+ (15+(N/15)*15)*(N/15)/2
	
  	cout<<sum<<endl;
  
    return 0;
}