Class Main
    Public Shared Sub Main()
        Dim N As Integer = Console.ReadLine()
        Dim i As Integer
        Dim sum As Long = 0
        For i = 1 To N
    If fix(i / 3) * 3 <> i Then
      If fix(i / 5) * 5 <> i Then
                    sum += i
                End If
            End If
        Next
        Console.WriteLine(sum)
    End Sub
End Class
