let rec calc i cum n =
  if i > n
  then cum
  else 
    if i mod 3 <> 0 && i mod 5 <> 0
    then calc (i+1) (cum+i) n
    else calc (i+1) (cum) n


let () = Printf.printf "%d\n" @@ Scanf.scanf "%d" (calc 1 0)
