#B4118. Exclusive Divisibility Count

    ID: 11775 Type: Default 1000ms 256MiB

Exclusive Divisibility Count

Exclusive Divisibility Count

Given three positive integers N, A, and B with \(A \neq B\), count the number of integers in the range \(1 \le x \le N\) that are divisible by exactly one of \(A\) or \(B\) (i.e. divisible by one and not the other).

In other words, count the integers \(x\) such that either

  • \(x \bmod A = 0\) and \(x \bmod B \neq 0\), or
  • \(x \bmod B = 0\) and \(x \bmod A \neq 0\).

inputFormat

The input consists of a single line containing three space-separated positive integers: N, A, and B, where \(A \neq B\).

outputFormat

Output a single integer, the count of numbers between 1 and N that are divisible by exactly one of A or B.

sample

10 2 3
6