#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=1e3+5;
const int mod=2147483648;
signed main(){
int ans=0;
for(int i=1;i<1000;i++){
if(i%3==0||i%5==0)ans+=i;
}
cout<<ans<<endl;
return 0;
}