1146_D. Frog Jumping
A frog is initially at position 0 on the number line. The frog has two positive integers a and b. From a position k, it can either jump to position k+a or k-b.

Let f(x) be the number of distinct integers the frog can reach if it never jumps on an integer outside the interval [0, x]. The frog doesn't need to visit all these integers in one trip, that is, an integer is counted if the frog can somehow reach it if it starts from 0.

Given an integer m, find ∑_{i=0}^{m} f(i). That is, find the sum of all f(i) for i from 0 to m.

Input

The first line contains three integers m, a, b (1 ≤ m ≤ 10^9, 1 ≤ a,b ≤ 10^5).

Output

Print a single integer, the desired sum.

Examples

Input


7 5 3


Output


19


Input


1000000000 1 2019


Output


500000001500000001


Input


100 100000 1


Output


101


Input


6 4 5


Output


10

Note

In the first example, we must find f(0)+f(1)+…+f(7). We have f(0) = 1, f(1) = 1, f(2) = 1, f(3) = 1, f(4) = 1, f(5) = 3, f(6) = 3, f(7) = 8. The sum of these values is 19.

In the second example, we have f(i) = i+1, so we want to find ∑_{i=0}^{10^9} i+1.

In the third example, the frog can't make any jumps in any case.
```python
from math import gcd

m,a,b = map(int,input().split())

g = gcd(a,b)

vis = [0]*(a+b+1)
vis[0] = 1

nvis = 1

count = 0
last = 0
t = 0
while True:
    #print(t, vis)
    if t >= b:
        #print('back')
        t -= b
        if vis[t]:
            break
        vis[t] = 1
        nvis += 1
    else:
        t += a
        if t > m:
            break
        if t > last:
            #print('forward', t - last, 'with', nvis)
            count += (t - last)*nvis
            last = t
        if vis[t]:
            break
        vis[t] = 1
        nvis += 1
    #print(nvis,count)
    #print('---')

if t > m:
    # we're done
    count += (m - last + 1)*nvis
else:
    def sumto(n):
        whole = n//g + 1
        r = whole*(whole+1)//2 * g
        corr = whole * (g-1 - (n%g))
        r -= corr
        return r

    #S = 0
    #for i in range(last, m+1):
    #    S += i//g + 1
    #count += S
    #assert S == sumto(m) - sumto(last-1)

    count += sumto(m) - sumto(last-1)

#print(vis)
print(count)

```