#include <stdio.h>
int main (void)
{
  int n, wa1, wa2, wa3, wa4, i, ans;
  scanf("%d", &n);
  wa1 = 0;
  wa2 = 0;
  wa3 = 0;
  wa4 = 0;
  int x, y, z;
  x = n / 3;
  y = n / 5;
  z = n/ 15;
  //合計
  for(i = n;i > 0;i--){
  	wa1 = wa1 + i;
  }
  //3n
  for(i = 0;i <= x;i++){
  	wa2 = wa2 + 3 * i;
  }
  //5n
  for(i = 0;i <= y;i++){
  	wa3 = wa3 + 5 * i;
  }
  //15n
  for(i = 0;i <= z;i++){
  	wa4 = wa4 + 15 * i;
  }
  ans = wa1 - wa2 - wa3 + wa4;
  printf("%d", ans);
  return 0;
}