#!/usr/bin/env python3 # from typing import * import sys import io import math import collections import decimal import itertools import bisect import heapq def input(): return sys.stdin.readline()[:-1] # sys.setrecursionlimit(1000000) # _INPUT = """# paste here... # """ # sys.stdin = io.StringIO(_INPUT) T, A, B = map(int, input().split()) T -= 1 ans = (T//A+1) + (T//B+1) - (T//(A*B//math.gcd(A,B))+1) print(ans)