#include<bits/stdc++.h>
using namespace std;

int main(){
    int N;
    cin >> N;
    int sum=0;
    for(int i=0; i<N;i++){
        int num = i+1;
        if(num %3 == 0 || num %5 == 0){
            sum += num;
        }
    }

    cout << sum << endl;
}