stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

    int n;

    cin>>n;

    ll ans=0;

    for(int i=1;i<=n;i++){

        if(i%3&&i%5){ans+=i;}

    }cout<<ans;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

    long long int n, s = 0;

    scanf("%lld", &n);

    for (int i = 1; i <= n; i++) {

        if ((i % 3) == 0 || (i % 5) == 0) {

            s = s;

        } else {

            s += i;

        }

    }

    printf("%lld", s);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



int n;

long long sum=0;



int main()

{

	scanf("%d",&n);



	for(int i=1;i<=n;i++)

	{

		if(i%3!=0&&i%5!=0)sum=sum+i;

			

	}

	

	printf("%lld",sum);



	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

    long long int n, s = 0;

    scanf("%lld", &n);

    for (int i = 1; i <= n; i++) {

        if ((i % 3) == 0 || (i % 5) == 0) {

            s = s;

        } else {

            s += i;

        }

    }

    printf("%lld", s);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#pragma warning(disable:4996)

#include<iostream>

#include<stdio.h>

#include<sstream>

#include<cmath>

#include<stack>

#include<vector>

#include<string>

#include<algorithm>

#include<queue>

#include<map>

#include<set>

#include<limits.h>

using namespace std;

using ll = long long int;

inline ll get(ll i) {

	return (i + 1) * i / 2;

}

int main() {

	ll N;

	cin >> N;

	ll NDT = get(N / 3) * 3, NDF = get(N / 5) * 5, NDFIT = get(N / 15) * 15,

		FN = get(N);

	cout << FN - NDT - NDF + NDFIT;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

    long long int n, s = 0;

    scanf("%lld", &n);

    for (int i = 1; i <= n; i++) {

        if ((i % 3) == 0 || (i % 5) == 0) {

            s = s;

        } else {

            s += i;

        }

    }

    printf("%lld", s);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <stdio.h>



int main(){



    long long int brpKali;

    int count=0;

    long long int hasil=0;

    int i=1;

    int j=0;

    long long int arrTampungan[1000000];

    scanf("%lld", &brpKali);

    while(i<=brpKali){

        if(i%3==0 && i%5!=0){

            //printf("Fizz");

        }

        else if(i%5==0 && i%3!=0){

            //printf("Buzz");

        }

        else if(i%3==0 && i%5==0){

            //printf("FizzBuzz");

        }

        else{

           // printf("%d", i);

            arrTampungan[j]=i;

           // printf("\n ini array tampungan ke-%d :%d\n",j , arrTampungan[j]);

            count++;

            j++;

        }

        i++;



    }

 for(int k=0;k<count;k++){

    hasil+=arrTampungan[k];

 }

printf("%lld\n", hasil);

 

 

    return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long int input, total = 0;

	

	scanf ("%lld", &input);

	

	for (int i = 1; i <= input; i++){

		if(i % 3 != 0 && i % 5 != 0){

        total += i;

    	}

	}

	

	printf ("%lld", total);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;



#define ll long long

#define ull unsigned long long



#define min(a, b) ((a) > (b) ? (b) : (a))

#define max(a, b) ((a) > (b) ? (a) : (b))



bool isPalindrome(string s) {

    string t(s.rbegin(), s.rend());

    return s == t;

}



int main(void) {

    ll N;

    ll count = 0;

    cin >> N;

    for(ll i = 1;i <= N;i++) {

        if(!(i % 3 == 0 && i % 5 == 0) && !(i % 3 == 0) && !(i % 5 == 0)) count += i;

    }

    cout << count << endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>



long total = 0;



void FizzBuzz(const int m) {

    if(m % 3 != 0) {

        if(m % 5 != 0) total += m;

    }

}



int main(void) {

    int i, m;



    scanf("%d", &m);

    for(i = 1;i <= m;i++) FizzBuzz(i);



    printf("%ld\n", total);



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<iomanip>

#include<algorithm>

#include<cstring>

#include<cmath>

#include<vector>

#include<map>

using namespace std;

string s[10005];

int main() 

{

	int n;

    cin>>n;

    long long ans=0;

    for (int i=1;i<=n;i++)

    {

        if (i%3==0)

        continue;

        else if (i%5==0)

        continue;

        else

        ans+=i;

    }

    cout<<ans<<endl;

    return 0;

}




// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long int a;

	long long int sum=0;

	scanf("%lld", &a);

	for(int i=1;i<=a;i++){

		if(i%3!=0&&i%5!=0){

			sum+=i;

		}

	}

	printf("%lld", sum);

	

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main(){

	long long n,sum=0;

	cin>>n;

	for(int i=1;i<=n;i++){

		if(i%3==0 || i%5==0){

			continue;

		}

		else{

			sum+=i;

		}

	}

	cout<<sum;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long int a;

	long long int sum=0;

	scanf("%lld", &a);

	for(int i=1;i<=a;i++){

		if(i%3!=0&&i%5!=0){

			sum+=i;

		}

	}

	printf("%lld", sum);

	

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int N;

    long long int sum=0;

    scanf("%d",&N);

    for(long long int i=1;i<=N;i++)

    {

        if(i%3!=0 && i%5!=0 && (i%3!=0 && i%5!=0))

        {

            sum = sum + i;

        }

    }

    printf("%lld\n",sum);

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long int a;

	long long int sum=0;

	scanf("%lld", &a);

	for(int i=1;i<=a;i++){

		if(i%3!=0&&i%5!=0){

			sum+=i;

		}

	}

	printf("%lld", sum);

	

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    long long unsigned i,N,sum=0;

    cin>>N;



    for(i=1;i<=N;i++){

        if(i%3!=0&&i%5!=0){

            sum=sum+i;

        }

    }

    cout<<sum<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long int a;

	long long int sum=0;

	scanf("%lld", &a);

	for(int i=1;i<=a;i++){

		if(i%3!=0&&i%5!=0){

			sum+=i;

		}

	}

	printf("%lld", sum);

	

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#include <cstring>



#define pi 2*acos(0.00)

#define ll long long

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define nl '\n'

#define null '\0'



using namespace std;



int main()

{

    fastio;



    ll n,i,sum=0;

    cin>>n;

    for(i=1;i<=n;i++)

    {

        if(i%3!=0&&i%5!=0)

        sum+=i;

    }    

    cout<<sum;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long int a;

	long long int sum=0;

	scanf("%lld", &a);

	for(int i=1;i<=a;i++){

		if(i%3!=0&&i%5!=0){

			sum+=i;

		}

	}

	printf("%lld", sum);

	

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{

	long long  n;

	cin>>n;

	long long  a[n+1];

	for(int i=1;i<=n;i++)

	a[i]=i;

	for(long long i=1;i<=n;i++)

	{

		if(a[i]%3==0||a[i]%5==0)

		a[i]=0;

	}

	long long sum=0;

	for(long long i=1;i<=n;i++)

	sum+=a[i];

	cout<<sum;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long int a;

	long long int sum=0;

	scanf("%lld", &a);

	for(int i=1;i<=a;i++){

		if(i%3!=0&&i%5!=0){

			sum+=i;

		}

	}

	printf("%lld", sum);

	

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



#define forn(i, n) for (int i = 0; i < int(n); ++i)

#define for1(i, n) for (int i = 1; i <= int(n); ++i)

#define ms(a, x) memset(a, x, sizeof(a))

#define F first

#define S second

#define all(x) (x).begin(),(x).end()



using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

const int INF = 0x3f3f3f3f;

mt19937 gen(random_device{}());

template<typename... Args> void write(Args... args) { ((cout << args << " "), ...); cout<<endl;}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    int n;

    cin>>n;

    ll sum=0;

    for1(i,n){

        if(i%3 and i%5) sum+=i;

    }

    cout<<sum;

    return 0;

}




// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long int a;

	long long int sum=0;

	scanf("%lld", &a);

	for(int i=1;i<=a;i++){

		if(i%3!=0&&i%5!=0){

			sum+=i;

		}

	}

	printf("%lld", sum);

	

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



int main()

{

    long long n;

    cin>>n;

    long long count=0;

    for(long long i=1;i<=n;i++){

        if((i%3 == 0) && (i%5==0))

            {//cout<<"FizzBuzz\n";

            count+=i;}

        else if(i%3 == 0)

            {//cout<<"Fizz\n";

            count+=i;}

        else if(i%5 == 0)

            {//cout<<"Buzz\n";

            count+=i;}

     }

     cout<<(n*(n+1))/2-count<<endl;

    return 0;

}  

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long int a;

	long long int sum=0;

	scanf("%lld", &a);

	for(int i=1;i<=a;i++){

		if(i%3!=0&&i%5!=0){

			sum+=i;

		}

	}

	printf("%lld", sum);

	

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

inline ll calc(ll x) {

	return (x+1)*x/2; 

}

int main() {

	ll n,ans;

	cin>>n;

	ans=calc(n)-calc(n/3)*3-calc(n/5)*5+calc(n/15)*15;

	cout<<ans<<endl;

	return 0;

} 

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long int a;

	long long int sum=0;

	scanf("%lld", &a);

	for(int i=1;i<=a;i++){

		if(i%3!=0&&i%5!=0){

			sum+=i;

		}

	}

	printf("%lld", sum);

	

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

#define ll long long



int main()

{

    ios_base::sync_with_stdio(false);

	cin.tie(NULL);

	cout.tie(NULL);

    ll n;

    cin >> n;

    ll sum = 0;

    for (int i=1; i<=n; i++){

        if (i % 3 == 0 || i % 5 == 0){continue;}

        else {sum += i;}

    }

    cout << sum << endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

int main(){

	long long int n,sum=0;

	scanf("%ld",&n);

		for(int i=1;i<=n;i++){

		if(i%3 == 0 && i%5 ==0) continue;

		else if(i%3==0) continue;

		else if(i%5==0) continue;

		sum += i;

		}

			printf("%lld\n",sum);

 	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
	#include<bits/stdc++.h>

    using namespace std;

    #define 	ll 			long long

    #define 	w(t)		int t; cin>>t; while(t--)  

	#define 	AsmShuvo()  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

			

    int main()

    {

    AsmShuvo()

    	

    	ll N, sum=0, i;

		cin>>N;

			

		for(i=1; i<=N; i++){

		if(i%3 != 0 && i%5 != 0){

			sum = sum+i;

		    }

		}

		cout<<sum<<endl;

			



	}

	


// Optimized solution to the same problem (faster):
#include <stdio.h>

int main(){

	long long int n,sum=0;

	scanf("%ld",&n);

		for(int i=1;i<=n;i++){

		if(i%3 == 0 && i%5 ==0) continue;

		else if(i%3==0) continue;

		else if(i%5==0) continue;

		sum += i;

		}

			printf("%lld\n",sum);

 	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<string>

#include<algorithm>

#define LL long long

#define FIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)

using namespace std;



int main()

{

	FIO;

	LL n, sum=0; cin>>n;

	for(LL i=1; i<=n; i++) if(i%3!=0&&i%5!=0) sum+=i;

	cout<<sum<<endl;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

int main(){

	long long int n,sum=0;

	scanf("%ld",&n);

		for(int i=1;i<=n;i++){

		if(i%3 == 0 && i%5 ==0) continue;

		else if(i%3==0) continue;

		else if(i%5==0) continue;

		sum += i;

		}

			printf("%lld\n",sum);

 	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

long long int math(long long int x)

{

	long long int ans;

	ans=x*(x+1)/2;

	return ans;

}

int main()

{

	ios_base::sync_with_stdio(false);

	cin.tie(NULL);

	cout.tie(NULL);

	long long int ff,n,fv,th,total,totalff,totalfv,totalth,ans;

	cin>>n;

	total= math(n);

	ff=n/15;

	totalff=15*math(ff);

	th=(n/3);

	totalth=3*math(th);

	fv=(n/5);

	totalfv=5*math(fv);

	ans=total-totalfv-totalth+totalff;

	cout<<ans;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

int main(){

	long long int n,sum=0;

	scanf("%ld",&n);

		for(int i=1;i<=n;i++){

		if(i%3 == 0 && i%5 ==0) continue;

		else if(i%3==0) continue;

		else if(i%5==0) continue;

		sum += i;

		}

			printf("%lld\n",sum);

 	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
// writer: w33z8kqrqk8zzzx33

#include <bits/stdc++.h>

using namespace std;



// begin fast read template by CYJian (source: https://www.luogu.com.cn/paste/i11c3ppx)



namespace io {

	const int __SIZE = (1 << 21) + 1;

	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;

	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)

	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }

	inline void gc (char &x) { x = Gc(); }

	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }

	inline void pstr (const char *s) { int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }

	inline void gstr (char *s) { for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();

		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0; }

	template <class I> inline bool gi (I &x) { _eof = 0;

		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }

		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }

	template <class I> inline void print (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;

		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }

	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;

} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::print;



// end fast read template by CYJian



#define iter(i, a, b) for(int i=(a); i<(b); i++)

#define rep(i, a) iter(i, 0, a)

#define rep1(i, a) iter(i, 1, (a)+1)

#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl

#define all(a) a.begin(), a.end()

#define fi first

#define se second

#define pb push_back

#define mp make_pair

 

using ll=long long;

using pii=pair<int, int>;

//#define int ll

const int MOD = 1000000007;



signed main() {

    ios_base::sync_with_stdio(false); cin.tie(0);

    int n; gi(n);

	ll ans = 0;

	rep1(i, n) if(i % 3 && i % 5) ans += i;

	print(ans);

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

typedef long long LL;



int n;



LL s(int x)

{

	int b = n / x * x, c;

	c = b / x + 1;

	return (LL)b * (LL)c / 2;	 

}



int main()

{		

		

	scanf("%d", &n);

	printf("%lld\n", s(1) - s(3) - s(5) + s(15));

			

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

 

//Made with <3 by MinumCoklatPanas

typedef long long ll;

const int INF = 1e9;

const ll INFF = 1e18;

const int MAXN = 510;

const int MOD = 1e9 + 7;

const double PI = acos(-1.0);

const double INFD = 1E9;

const double EPS = 1e-9;



int main()

{

	ios_base::sync_with_stdio(false);

	cin.tie(0);

	cout.tie(0);

	int n;

	cin >> n;

	ll ans = 0;

	for (int i = 1 ; i <= n ; i++)

	{

		if (__gcd(i,15) == 1)

			ans += i;

	}

	cout << ans << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

 

int main(){

    long long int na;

    long long int hasil =0;

    scanf("%lld", &na);

    

    for (int i=1 ; i<=na ; i++){

        if (i%3 == 0 || i%5 == 0 ){

            continue;

        }

        else {

            hasil+=i;

        }

    }

    printf("%lld", hasil);



    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
///HELLO THERE~!

///CREATED BY MD SADMAN MEHEDI SIVAN(IUT CSE-SWE^19)



#include <bits/stdc++.h>



#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define read freopen("blue.txt","r",stdin);

#define write freopen("red.txt","w",stdout);

#define pie 2*acos(0.0);



typedef long long ll;



using namespace std;





int main()



{



    fastio;



    long long N;

    cin>>N;



    long long totalsum=0;



    for(long long i=1;i<=N;i++)

    {

         if(i%3==0 || i%5==0 ||i%15==0)

            continue;



        totalsum=totalsum+i;



    }

    cout<<totalsum;

    return 0;



}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	int a;

	long long int total = 0;

	scanf("%d", &a);

	

	for(int i = 1; i <= a; i++){

		if(i % 5 ==0 && i % 3 ==0 ){

			printf("");

		}

		else if (i % 3 ==0){

			printf("");

		}

		else if (i%5==0){

			printf("");

		}

		else{

			total = total + i;

		}

	}

	

	printf("%lld", total);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
/*    Mohammed Sami Khan

                       মোহাম্মদ সামী খান

*/

#include<bits/stdc++.h>

using namespace std;

#define pi acos(-1.0)

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

typedef long long ll;

typedef unsigned long long ull;



int main()

{

    fastio;

    ll t, n, m, i, p, q, r, sum=0, a, b, c, d, f=0;

    char *ye="YES", *no="NO";

    cin>>m;

    for(i=1;i<=m;i++){

        if(i%3==0 || i%5==0) continue;

        sum+=i;

    }

    cout<<sum<<endl;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	int a;

	long long int total = 0;

	scanf("%d", &a);

	

	for(int i = 1; i <= a; i++){

		if(i % 5 ==0 && i % 3 ==0 ){

			printf("");

		}

		else if (i % 3 ==0){

			printf("");

		}

		else if (i%5==0){

			printf("");

		}

		else{

			total = total + i;

		}

	}

	

	printf("%lld", total);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

      ios_base::sync_with_stdio(false);

      long long int n,k,a,b=0,c,m,i,j,p,q;

      cin>>n;

      for(i=1;i<=n;i++){

            if(i%3!=0 && i%5!=0)b+=i;

      }

      cout<<b;

      return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	int a;

	long long int total = 0;

	scanf("%d", &a);

	

	for(int i = 1; i <= a; i++){

		if(i % 5 ==0 && i % 3 ==0 ){

			printf("");

		}

		else if (i % 3 ==0){

			printf("");

		}

		else if (i%5==0){

			printf("");

		}

		else{

			total = total + i;

		}

	}

	

	printf("%lld", total);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;



signed main()

{

	int n;

	cin>>n;

	ll cnt=0;

	for(int i=1;i<=n;i++){

		if(i%3&&i%5)cnt+=i;

	}

	cout<<cnt<<endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	int a;

	long long int total = 0;

	scanf("%d", &a);

	

	for(int i = 1; i <= a; i++){

		if(i % 5 ==0 && i % 3 ==0 ){

			printf("");

		}

		else if (i % 3 ==0){

			printf("");

		}

		else if (i%5==0){

			printf("");

		}

		else{

			total = total + i;

		}

	}

	

	printf("%lld", total);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{

    long long n,sum=0;

    cin>>n;

    for(int i=1;i<=n;i++)

    {

        if(i%3!=0&&i%5!=0)

        {

            sum+=i;

        }

    }

    cout<<sum<<endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	int a;

	long long int total = 0;

	scanf("%d", &a);

	

	for(int i = 1; i <= a; i++){

		if(i % 5 ==0 && i % 3 ==0 ){

			printf("");

		}

		else if (i % 3 ==0){

			printf("");

		}

		else if (i%5==0){

			printf("");

		}

		else{

			total = total + i;

		}

	}

	

	printf("%lld", total);

	return 0;

}

// Fastest known solution for this problem: