small-is-cute-1
Source: hackerearth
Difficulty: EASY

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


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)


def gcd(a,b):
	min = b
	max = a
	g = 0
	if (a < b):
		min = a
		max = b
	while ((max % min) > 0):
		t = max % min
		max = min
		min = t
	return min

s = input()
lst = s.split(' ')
n = int(lst[0])
a = int(lst[1])
b = int(lst[2])

sum = 0
for x in range(a,n,a):
	sum = sum + x
for x in range(b,n,b):
	sum = sum + x

g = gcd(a,b)
lcm = (a*b)/g
for x in range(lcm,n,lcm):
	sum = sum - x

print(sum)


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


n,a,b=[int(x) for x in input().split()]
s=0
for i in range(1,((n-1)/a)+1):
	s+=(a*i)
for j in range(1,((n-1)/b)+1):
	s+=(b*j)
for k in range(1,((n-1)/(a*b))+1):
	s-=((a*b)*k)
print(s)




def main():
	N, A, B = input().split(" ")
	N = int(N)
	A = int(A)
	B = int(B)
	ans = 0
	if(N % A == 0):
		n = N / A - 1
	else:
		n = N / A
	if(N % B == 0):
		m = N / B - 1
	else:
		m = N / B
	if(N % (A * B) == 0):
		o = N / (A * B) - 1
	else:
		o = N / (A * B)
	ans = (A * (n * (n + 1) / 2)) + (B * (m * (m + 1) / 2)) - ((A * B) * (o * (o + 1) / 2))
	print(ans)
main()


def getGcd(a,b):
	if(a%b==0):
		return b;
	return getGcd(b,a%b);
t=input().split(' ');
a=int(t[1]);
b=int(t[2]);
n=int(t[0]);
gcd=1;
if(a>b):
	gcd=getGcd(a,b);
else:
	gcd=getGcd(b,a);
lcm=(a*b)/gcd;
a1=0;
b1=0;
c1=0;
if(int(n/a)*a==n):
	a1=int(n/a)-1;
else:
	a1=int(n/a);

if((n/b)*b==n):
	b1=int(n/b)-1;
else:
	b1=int(n/b);
if(int(n/lcm)*lcm==n):
	c1=int(n/lcm)-1;
else:
	c1=int(n/lcm);

sum1=a1*(a1+1);
sum1/=2;
sum2=b1*(b1+1);
sum2/=2;
sum3=c1*(c1+1);
sum3/=2;
print(a*sum1+b*sum2-lcm*sum3);

	



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)