Given three positive integers N, A and B (A < B < N), find the sum of all positive integers less than N, which are divisible by either A or B.

For example, when N = 20, A = 4 and B = 7, the possible values are 4, 7, 8, 12, 14, and 16. Their sum is 61.
Input Format
The only line of the input file contains three space separated integers N, A and B.

Output Format
Output the required sum.

Constraints
10 ≤ N ≤ 50000
2 ≤ A < B < N

SAMPLE INPUT
20 4 7

SAMPLE OUTPUT
61

Difficulty: EASY

Solutions:
s = input("")
a,b,c = s.split()
a = eval(a)
b = eval(b)
c = eval(c)
sum = 0
for i in range(a):
	if i % b==0 or i % c==0:
		sum = sum + i
	else:
		sum = sum
print (sum)		


def main():
	N, A, B = input().split(" ")
	N = int(N)
	A = int(A)
	B = int(B)
	i = A
	ans = 0
	count = 0
	diff = B - A
	while(i < N):
		ans = ans + i
		count = count + 1
		if((i + count * diff) < N and (i + count * diff) % A != 0):
			ans = ans + (i + count * diff)
		i = A * (count + 1)
	print(ans)
main()


num=input()
list1=[]
list2=[]
list1=num.split()
N=int(list1[0])
A=int(list1[1])
B=int(list1[2])
for i in range(N):
	if i%A==0:
		list2.append(i)
	elif i%B==0:
		list2.append(i)
sum1=0
for k in list2:
	sum1=sum1+k
print(sum1)

	


n,x,y=list(map(int,input().split()))
count=0
for i in range(x,n):
	if i %x==0 and i%y==0:
		count+=i
	elif i%x==0:
		count+=i
	elif i%y==0:
		count+=i
print(count)


list = input().split()
N = int(list[0])
A = int(list[1])
B = int(list[2])
sum = 0
for i in range (1, N):
	if i%A==0 or i%B==0:
		sum += i
print((str(sum)))
		


[n,a,b]=[int(i) for i in input().split(' ')];
s=0;
for i in range(1,n):
	if (i%a==0) or (i%b==0):
		s+=i;
print(s)


s = input("")
a,b,c = s.split()
a = eval(a)
b = eval(b)
c = eval(c)
sum = 0
for i in range(a):
	if i % b==0 or i % c==0:
		sum = sum + i
	else:
		sum = sum
print (sum)		


n, a, b = [int(x) for x in input().split()]

finalSum = 0
for i in range(n):
	if i % a == 0 or i % b == 0:
		finalSum += i

print(finalSum)


n,a,b=list(map(int,input().split()))
add=0
for i in range(2,n):
	if i%a==0 or i%b==0:
		add+=i
print((str(add)))



import sys
n,a,b=list(map(int,sys.stdin.readline().split()))
danger=0
for i in range(a,n):
	if i%a==0 or i%b==0:
		danger+=i
print(danger)


A,B,N=list(map(int,input('').split()))
i=1
sum=0
while i<A:
	if i%B==0 or i%N==0:
		sum+=i
	i+=1
print(sum)


t=input()
l=t.split()
n=int(l[0])
a=int(l[1])
b=int(l[2])
i=1
sum=0
while (i<n) :
	if i%a==0 or i%b==0 :
	  sum+=i
	i+=1
print(sum)	


fline=input()
lst=[]
lst=fline.split()
lstt=[]
count=0
for ch in lst:
	lstt.append(int(ch))

for i in range(1,lstt[0]):
	if i%lstt[1]==0 or i%lstt[2]==0:
		count=count+i
print(count)

	


t= input().split()
n=int(t[0])
a=int(t[1])
b=int(t[2])
list=[n]
sum=0
for x in range(1,n):
	if (x%a==0 or x%b==0):
		sum=sum+x
print(sum)	


s = input("")
a,b,c = s.split()
a = eval(a)
b = eval(b)
c = eval(c)
sum = 0
for i in range(a):
	if i % b==0 or i % c==0:
		sum = sum + i
	else:
		sum = sum
print (sum)		


N,A,B = list(map(int,input().split(' ')))
ans=0
for i in range(N):
	if(i%A == 0 or i%B == 0):
		ans+=i
print(ans)


t=input()
l=t.split()
n=int(l[0])
a=int(l[1])
b=int(l[2])
sum=0
for i in range(n):
	if i%a==0 or i%b==0:
		sum+=i
print(sum)
		
	  



'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
if __name__ == '__main__':
	input_numbers = [int(x) for x in input().strip().split(' ')]
	N = input_numbers[0]
	a = input_numbers[1]
	b = input_numbers[2]
	start = a
	count = 0
	while start < N:
		if start % a == 0 or start % b == 0:
			count = count + start
		start = start + 1
	print(count)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
var1, var2, var3 = list(map(int, input().split()))

if (var1 > var3 and var3 > var2):
	sum = 0
	for num in range(1, var1):
		if(num % var2 == 0 or num % var3 == 0):
		#	print num
			sum = sum + num

print(sum)