#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
 
 
int main()
{
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
	long long n;
	cin>>n;
	vector< int > a;
  for( int i = 0; i<n; i++ )
  {
    a.push_back(i+1);
  }
  int ans;
  ans = 0;
  for (int i = 0; i < n; i++)
  {
    if( a[i]%3==0 || a[i]%5==0 )
    {
        continue;
    }
    else
    {
        cout << a[i];
        ans = ans + a[i];
       
    }
  }
  cout<<ans;
  
    
}