Comrade Dujikov is busy choosing artists for Timofey's birthday and is recieving calls from Taymyr from Ilia-alpinist.

Ilia-alpinist calls every *n* minutes, i.e. in minutes *n*, 2*n*, 3*n* and so on. Artists come to the comrade every *m* minutes, i.e. in minutes *m*, 2*m*, 3*m* and so on. The day is *z* minutes long, i.e. the day consists of minutes 1, 2, ..., *z*. How many artists should be killed so that there are no artists in the room when Ilia calls? Consider that a call and a talk with an artist take exactly one minute.
The only string contains three integers — *n*, *m* and *z* (1 ≤ *n*, *m*, *z* ≤ 10<sup class="upper-index">4</sup>).
Taymyr is a place in the north of Russia.

In the first test the artists come each minute, as well as the calls, so we need to kill all of them.

In the second test we need to kill artists which come on the second and the fourth minutes.

In the third test — only the artist which comes on the sixth minute.
1 1 10
10
1 2 5
2
2 3 9
1
4 8 9
1
7 9 2
0
10000 10000 10000
1
24 22 9235
34
74 8 417
1
972 1 203
0
550 1 754
1
860 1 884
1
358 2 809
2
33 27 216
0
2940 1 9311
3
4624 1 1953
0
2696 2 7345
2
3443 2 6701
0
3 613 2275
1
1 10000 10000
1
10000 1 10000
1
1 1 1
1
1 1 10000
10000
34 27 10000
10
2 2 9999
4999
2 2 1
0
6 4 36
3
33 6 3005
45
5 1 20
4
1 2 10
5
2 1 100
50
10 20 10000
500
8 12 12
0
# n = int(input())
# a = []
# m = []
# for i in range(n):
#     d,k = [int(i) for i in input().split()]
#     if k % d != 0:
#         a.append(k % d)
#     else:
#         pass
# a_set = set(a)
# most = None
# most1 = 0
# for i in a_set:
#     q = a.count(i)
#     if q >= most1:
#         most1 = q
#         most = i
#         m.append(i)
# b = -1
# for i in range(len(m)):
#     if m[i] > b:
#         b = a[i]
# print(b)
#
# n = int(input())
# s = input()
# k = 0
# flag = False
# def decode():
#     global s,k,flag
#     s1 = re.search(r'xxx',s)
#     if s1:
#         end = s1.end()
#         k += 1
#         s = s[end:]
#         flag = True
#         decode()
#     else:
#         pass
# decode()
# if flag:
#     print(k)
# else:
#     print(0)
#
# import time
# start_time = time.clock()
# a1 = []
# res = []
# a = None
# while a != 0:
#     a = int(input())
#     a1.append(a)
# for i in range(1,len(a1)):
#     for j in range(1,len(a1)):
#         if (a1[i-1] * a1[j-1]) % 7 == 0 and (a1[i-1] * a1[j-1]) % 49 != 0:
#             res.append(a1[i-1] * a1[j-1])
#         else:
#             pass
# print(max(res))
# print(time.clock() - start_time)
#
# n = int(input())
# i = 0
# k = []
# x = []
# y = []
# while i != n:
#     a,b = [int(i) for i in input().split()]
#     x.append(a)
#     y.append(b)
#     i += 1
# for i in range(n):
#     if x[i] >= 0 and y[i] >= 0:
#         k.append(1)
#     elif x[i] <= 0 and y[i] >= 0:
#         k.append(2)
#     elif x[i] <= 0 and y[i] <= 0:
#         k.append(3)
#     else:
#         k.append(4)
# k1 = {i: k.count(i) for i in set(k)}
# k1 = max(k1.items())
# print('K = ',k1[0])
# print('M = ',k1[1])
#
# import time
# t = time.clock()
# n = int(input())
# n1 = n
# a = []
#
# while n1 != 0:
#     a.append(int(input()))
#     n1 -= 1
# m = a[0] + a[7]
# for i in range(n-7):
#     if a[i] + a[i+7] > m:
#         m = a[i] + a[i+7]
# print(m)
# print(time.clock()-t)
#
# n = int(input())
# n1 = n
# x = []
# y = []
# s = []
# while n1 != 0:
#     a,b = [int(i) for i in input().split()]
#     x.append(a)
#     y.append(b)
#     n1 -= 1
# for i in range(n):
#     if y[i] % x[i] == 0:
#         pass
#     else:
#         s.append(y[i] % x[i])
# s1 = {i: s.count(i) for i in set(s)}
# s1 = max(s1.items())
# print(s1[0])
#
# s1 = input()
# s2 = input()
# s1_list = list(s1)
# s2_list = list(s2)
# s1_list.sort()
# s2_list.sort()
# if s1_list == s2_list:
#     print('Yes')
# else:
#     print('No')
#
# k = 0
# s1 = input()
# s1_sort = {i:s1.count(i) for i in set(s1)}
# for i in range(1,len(s1)):
#     if s1[i-1] == s1[i]:
#         s1.replace(s1[i+1],'')
# print(s1)
#
# a = [6,3,5,7,4,2]
# m1 = 1000
# m2 = 1000
# for i in range(len(a)):
#     if a[i] < m1:
#         m2 = m1
#         m1 = a[i]
#     elif a[i] < m2:
#         m2 = a[i]
# print(m1,m2)
#
# import random
#
# a = ord('a')
# A = ord('A')
# z = ord('z')
# Z = ord('Z')
# c = ord('0')
# n = [chr(i) for i in range(a, z + 1)]
# for j in range(A, Z + 1):
#     n.append(chr(j))
# for i in range(c, c + 10):
#     n.append(chr(i))
# k = random.sample(n, 20)
# print(k)
# s = input()
# a = [i for i in s]
# di = {i:a.count(i) for i in a}
# di = sorted(di.items())
# print(di[0][0],'find',di[0][1])
#
# import random
#
# a = [input() for _ in range(3)]
# a = {i:a.count(i) for i in set(a)}
# a = sorted(a.items(), key=lambda x: x[1], reverse=True)
# print(int(a[0][0]), a[0][1])
#
# c = 10000
# n = 15
# a = [int(input()) for _ in range(18)]
# while n != len(a):
#     for i in range(15,len(a)):
#         if (a[i-n] * a[i]) % 2 == 0 and (a[i-n] * a[i]) < c:
#             c = a[i-n] * a[i]
#     n += 1
# print(c)
#
# a = input()
# b = []
# k = 0
# flag = True
# n = ['0','1','2','3','4','5','6','7','8','9']
# for i in a:
#     if i.isdigit():
#         b.append(i)
# while flag:
#     c = {i: b.count(i) for i in set(b)}
#     for i in c.items():
#         if i[1] == 1:
#             key = i[0]
#             k += 1
#     if k > 1:
#         print('No')
#         flag = False
#     if k == 1:
#         l = [0] * (len(b) + 2)
#         l[len(l) // 2] = key
#         j = 0
#         x = 1
#         while j != len(n):
#             for i in c.keys():
#                 if i == n[j]:
#                     l[(len(l) // 2) + x] = i
#                     l[(len(l) // 2) - x] = i
#                     x += 1
#             j += 1
#         for i in range(0,(len(l) // 2)-1):
#             if l[i] == key:
#                 del l[i]
#         for i in range(len(l) // 2,len(l)):
#             if l[i] == key:
#                 del l[i]
#         print(l)
#         flag = False
#     if k == 0:
#         l = [0] * (len(b))
#         x = 0
#         o = 1
#         j = 0
#         while j != len(n):
#             for i in c.keys():
#                 if i == n[j]:
#                     l[(len(l) // 2) + x] = i
#                     l[(len(l) // 2) - o] = i
#                     x += 1
#                     o += 1
#             j += 1
#         print(l)
# n = 3
# m = 10000
# mn = m + 1
# a = [int(input()) for i in range(n)]
# if sum(a) % 6 != 0:
#     print(a, sum(a))
# else:
#     for i in a:
#         if i < mn:
#             mn = i
#     if mn < m:
#         print(n-1,sum(a)-mn)
#     else:
#         print(0,0)
# n = 4
# a = [0 for _ in range(n)]
# def func(i):
#     if i < 4:
#         for k in (0,1):
#             a[i] = k
#             func(i+1)
#     else:
#         c = 0
#         if (a[0] or a[1]) and (not a[2] or not a[3]):
#             c = 1
#         print(a,c)
#
# func(0)
#
# a = [i for i in range(1,100)]
# #b = [2, 3, 4, 1, 6, 5, 7, 9, 8]
# #print(list(enumerate(zip(a,b))))
# print(','.join([str(i) for i in range(1,100)]))
# print(','.join(map(str,a)))
#
# s = input()
# a = [i for i in s]
# if a[0] == a[0].upper():
#     print(''.join(a))
# else:
#     a[0] = a[0].upper()
#     print(''.join(a))
#
# n, a, b, res, c = int(input()), [], [], [], 0
# while n != 0:
#     x, y = [int(i) for i in input().split()]
#     a.append(x)
#     b.append(y)
#     n -= 1
# res.append(b[0])
# for i in range(1, len(a)):
#     res.append(res[c] - a[i] + b[i])
#     c += 1
# print(max(res))
#
#
# a = [i for i in input()]
# b = [i for i in input()]
# k,l = 0,0
# flag = True
# c1 = sorted(a, key=lambda x: (str.upper(x),x))
# c2 = sorted(b, key=lambda x: (str.upper(x),x))
# if flag:
#     for i, j in zip(c1,c2):
#         if i != j:
#             if ord(i.lower()) > ord(j.lower()):
#                 print(1)
#                 flag = False
#                 break
#             elif ord(i.lower()) < ord(j.lower()):
#                 print(-1)
#                 flag = False
#                 break
#             else:
#                 pass
# if flag:
#     print(0)
#
#
# for i, j in zip(a,b):
#     k += ord(i)
#     l += ord(j)
#     if i == j.upper():
#         l = k
#     elif j == i.upper():
#         k = l
# if k > l:
#     print(1)
# elif k < l:
#     print(-1)
# else:
#     print(0)
#
# a,n = [int(i) for i in input().split()]
# s = [i for i in input()]
# for _ in range(n):
#     flag = True
#     for i in range(len(s)-1):
#         if flag:
#             if s[i] == 'B' and s[i+1] == 'G':
#                 s[i], s[i+1] = s[i+1], s[i]
#                 flag = False
#         else:
#             flag = True
# print(''.join(s))
# n, m = int(input()), int(input())
#
#
# s = input()
# a = [0 for _ in range(len(s))]
# j = 0
# def func():
#     global s,j
#     k =  0
#     m = -1
#     for i in s:
#         if ord(i) > m:
#             m = ord(i)
#     if s.count(chr(m)) <= 1:
#         s = s.replace(chr(m),'')
#         return func()
#     else:
#         for i in range(j,s.count(chr(m))-j-1):
#             a[i] = chr(m)
#             a[len(a)-i-1] = chr(m)
#             k = i
#         j = k+1
#         s = s.replace(chr(m), '')
#         if (0 not in a) or (not list(s)):
#             print(a)
#         else:
#             s = s.replace(chr(m), '')
#             return func()
# func()
#
# s = input()
# m = -1
# j = 0
# k = 0
# a = [i for i in s]
# for i in range(len(a)):
#     if ord(a[i]) > m:
#         m = ord(a[i])
# if a.count(chr(m)) > 1:
#     for i in range(j,a.count(chr(m))):
#         a[a.index(chr(m))], a[i] = a[i], a[a.index(chr(m))]
#         k = i
#     j = k
# print(a)
#
# eng, r, e = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','w','x','y','z'],\
#             [], []
# s = input()
# for i in s:
#     if i in eng:
#         e.append(i)
#     else:
#         r.append(i)
# # if ' ' or '.' in e:
# #     # e.remove(' ')
# #     # e.remove('.')
# if ' ' or '.' in r:
#     r.remove(' ')
#     r.remove('.')
# for i in set(e):
#     print(i, e.count(i))
# for i in set(r):
#     print(i, r.count(i))
#
# BUBBLE
# n = int(input())
# a = [int(input()) for _ in range(n)]
# k = 6
# c = 0
# for i in range(n-6):
#     for j in range(i+6,n):
#         if (a[i] + a[j]) % 2 != 0:
#             c += 1
# print(c)
#
# SHELL
# a = [4,2,76,1,8,23]
# def shell():
#     t = int(len(a)/2)
#     while t > 0:
#         for i in range(len(a)-t):
#             j = i
#             while j >= 0 and a[j] > a[j+t]:
#                 a[j], a[j+t] = a[j+t], a[j]
#                 j -= 1
#         t = int(t/2)
#     return a
# print(shell())
#
#
#
# def fibonacci(n):
#     a, b = 0, 1
#     for _ in range(1, n):
#         a, b = b, a + b
#     return b
# print([fibonacci(i) for i in range(1,13)])
#
# def func(n):
#     if n in (1,2):
#         return 1
#     elif n % 3 == 0:
#         return func(n - 2) + func(n // 3)
#     else:
#         return func(n-2)
# a = [func(i) for i in range(1,56)]
# a = {i:j for i,j in zip(range(1,56), a)}
# print(a[55])
#
# b = [int(i) for i in input().split()]
# # n = int(input())
# # ind = int(input())
# a = []
# for i in range(1,b[0]+1):
#     if i % 2 != 0:
#         a.append(i)
# for i in range(1,b[0]+1):
#     if i % 2 == 0:
#         a.append(i)
# print(a[b[1]-1])
#
# a = []
# N = 10
# for i in range(0, N):
#     a.append(int(input()))
# m1 = min((i for i in a if i % 2 != 0), default=0)
# m2 = max((i for i in a if i % 2 != 0), default=0)
# for i in range(0,N):
#     if a[i] % 2 == 0 and m1 < a[i] < m2:
#         a[i] -= m1
# print(a)
#
# a = [-1,-2,6]
# m = min((i for i in a if i >=0 and i % 6 != 0), default='Не найдено')
# print(m)
#
# k = None
# flag = True
# n = int(input())
# a = [int(i) for i in input().split()]
# if sum(a) % 2 == 0:
#     print(sum(a))
# else:
#     while flag:
#         k = min(a)
#         if k % 2 != 0:
#             del a[a.index(k)]
#             if sum(a) % 2 == 0:
#                 print(sum(a))
#                 flag = False
#         else:
#             print(sum(a))
#             flag = False
#
# n = int(input())
# a = [int(input()) for _ in range(n)]
# k = 6
# m = -1
# while k != len(a):
#     for i in range(n-k):
#         if (a[i] + a[i+k])  > m and (a[i] + a[i+k]) % 2 != 0:
#             m = a[i] + a[i+k]
#     k += 1
# print(m)
#
# n = int(input())
#
# def func(n):
#     if n in (1,2):
#         return 1
#     if n == 0:
#         return 0
#     else:
#         return func(n-1)+func(n-2)
# for i in range(0,11):
#     print(func(i))
#
# a = [100,8,33,45,19,90]
# m = -1
# for i in range(len(a)):
#     for j in range(i,len(a)):
#         if a[i] + a[j] > m and (a[i] + a[j]) % 2 != 0:
#             m = a[i] + a[j]
# print(m)
#
# a = list()
# for i in range(2):
#     p = list(map(int,input().split()))
#     a.append(p)
# print(a)
#
# k = []
# a = [15,417,123,6,4841]
# for i in a:
#     k.append(i % 10 + (i // 10) % 10 )
# k = {i:k.count(i) for i in k}
# b = sorted(k.items(), key=lambda x: x[1], reverse=True)
# for i in range(len(b)):
#     if b[i][1] != max(k.values()):
#         del b[i]
# print(sorted(b, key=lambda x: x[0], reverse=True)[0][0])
#
#
#
# for i in range(len(a)):
#     min = i
#     for j in range(i+1, len(a)):
#         if a[j] < a[min]:
#             min = j
#     a[i], a[min] = a[min], a[i]
#
# for i in range(len(a)):
#     v = a[i]
#     j = i
#     while a[j-1] > v and j > 0:
#         a[j] = a[j-1]
#         j -= 1
#     a[j] = v
#
# for i in range(len(a),0,-1):
#     for j in range(1,i):
#         if a[j-1] > a[j]:
#             a[j], a[j-1] = a[j-1], a[j]
#
# t = len(a) // 2
# while t > 0:
#     for i in range(len(a) - t):
#         j = i
#         while j >= 0 and a[j] > a[j+t]:
#             a[j], a[j+t] = a[j+t], a[j]
#             j -= 1
#     t //= 2
#
#
# flag = True
# a = [2,6,8,19,7]
# if sum(a) % 2 != 0:
#     print(sum(a))
# else:
#     while flag:
#         k = min((i for i in a if i % 2 != 0), default=0)
#         j = a.index(k)
#         a[0], a[j] = a[j], a[0]
#         for i in range(len(a)-1):
#             a[i] = a[i+1]
#         del a[-1]
#         if sum(a) % 2 != 0:
#             print(sum(a))
#             flag = False
#
#
# n2,n31,n62,j,k = 0,0,0,0,0
# a = [2,13,26,62]
# for i in range(4):
#     if a[i] % 62 == 0:
#         n62 += 1
#     elif a[i] % 31 == 0:
#         n31 += 1
#     elif a[i] % 2 == 0:
#         n2 += 1
# print(n62*(len(a)-n62) + n2*n31 + (n62*(n62-1))//2)
#
#
#
# 27 54 54 27
# s = 6
# n = 10
# n1,n2,n3,n54,k,flag = 0,0,0,0,0,0
# a = [2,3,27,1,4,7]
# a.append(int(input()))
# for i in range(s,n):
#     flag += 1
#     if a[0] % 54 == 0:
#         n54 += 1
#     if a[0] % 3 == 0:
#         n3 += 1
#     if a[0] % 2 == 0:
#         n2 += 1
#     n1 += 1
#     if a[6] % 54 == 0:
#         k += n1
#     elif a[6] % 3 == 0:
#         k += n2
#     elif a[6] % 2 == 0:
#         k += n3
#     else:
#         k += n54
#     for j in range(0,s):
#         a[j] = a[j+1]
#     if flag < n-s:
#         a[s] = int(input())
# print(k)
#
# 27 54 54 27
# s = 6
# n = 10
# n1,n2,n3,n54,k = 0,0,0,0,0
# a = [2,3,27,1,4,7]
# for i in range(s,n):
#     a.append(int(input()))
#     if a[0] % 54 == 0:
#         n54 += 1
#     if a[0] % 3 == 0:
#         n3 += 1
#     if a[0] % 2 == 0:
#         n2 += 1
#     n1 += 1
#     if a[i] % 54 == 0:
#         k += n1
#     elif a[i] % 3 == 0:
#         k += n2
#     elif a[i] % 2 == 0:
#         k += n3
#     else:
#         k += n54
#     for j in range(0,s):
#         a[j] = a[j+1]
#     a[s] = a[i]
# print(k)
#
#
# s = 6
# n = 8
# n1,n2,d = 0,0,0
# a = [2,3,27,1,4,7]
# for i in range(s,n):
#     k = 0
#     a.append(int(input()))
#     if a[0] % 2 == 0:
#         n2 = a[0]
#     else:
#         n1 = a[0]
#     if a[i] % 2 == 0 and n1 > 0:
#         k = n1 + a[i]
#     elif a[i] % 2 != 0 and n2 > 0:
#         k = n2 + a[i]
#     if k > d:
#         d = k
#     for j in range(0,s):
#         a[j] = a[j+1]
#     a[s] = a[i]
# print(d)
#
# s = 6
# # n = 8
# # n0,n1,n2,k = 0,0,0,0
# # a = [2,3,27,1,4,7]
# # for i in range(s,n):
# #     a.append(int(input()))
# #     if a[0] % 3 == 0:
# #         n0 += 1
# #     if a[0] % 3 == 1:
# #         n1 += 1
# #     if a[0] % 3 == 2:
# #         n2 += 1
# #     if a[i] % 3 == 0:
# #         k += n0
# #     elif a[i] % 3 == 1:
# #         k += n2
# #     elif a[i] % 3 == 2:
# #         k += n1
# #     for j in range(0,s):
# #         a[j] = a[j+1]
# #     a[s] = a[i]
# # print(k)
#
#
# n = 23
# n0,n1,n2,k,d = 0,0,0,0,0
# a = [36,16,15,15,17,16,14,15,47,22,27,29,35,23,39,29,15,25,16,35,28,45,26]
# #a = [1,2,3,4,5,6,7,8,9,10]
# for i in range(1,n):
#     if a[0] % 3 == 0:
#         n0 = a[0]
#     if a[0] % 3 == 1:
#         n1 = a[0]
#     if a[0] % 3 == 2:
#         n2 = a[0]
#     if a[i] % 3 == 0 and i % 3 == 0 and n0 > 0:
#         k = n0 + a[i]
#     elif a[i] % 3 == 1 and i % 3 == 0 and n2 > 0:
#         k = n2 + a[i]
#     elif a[i] % 3 == 2 and i % 3 == 0 and n1 > 0:
#         k = n1 + a[i]
#     if k > d:
#         d = k
#     for j in range(0,n-1):
#         a[j] = a[j+1]
# print(d)
#
#
# n = 11
# s = 6
# n0, n1 = 0,0
# k1,k2,d = 0,0,1000000
# a = [int(input()) for _ in range(n-(n-s))]
# for i in range(s,n):
#     a.append(int(input()))
#     if a[0] % 2 == 0:
#         n0 = a[0]
#     if a[0] % 2 != 0:
#         n1 = a[0]
#     if a[i] % 2 == 0:
#         k1 = n0 * a[i]
#         k2 = n1 * a[i]
#     elif a[i] % 2 != 0:
#         k1 = n0 * a[i]
#     if k1 < d and k2 != 0:
#         d = k1
#     if k2 < d and k2 != 0:
#         d = k2
#     for j in range(1,len(a)):
#         a[j-1] = a[j]
# print(d)
#
# n = 11
# s = 6
# k = 1000000
# a = [int(input()) for _ in range(n)]
# while s != n:
#     for i in range(n-s):
#         if (a[i] * a[i+s]) % 2 == 0 and (a[i] * a[i+s]) < k:
#             k = a[i] * a[i+s]
#     s += 1
# print(k)
#
# n = 5
# k,d = 0,0
# n7,n2 = 0,0
# a = [int(input()) for _ in range(n)]
# for i in range(1,len(a)):
#     if a[0] % 7 == 0:
#         n7 = a[0]
#     if a[0] % 2 == 0:
#         n2 = a[0]
#     if a[i] % 7 == 0:
#         k = n2 * a[i]
#     elif a[i] % 2 == 0:
#         k = n7 * a[i]
#     if k > d:
#         d = k
#     for j in range(len(a)):
#         a[j-1] = a[j]
# print(d)
#
# s = 6
# n = int(input())
# a = [int(input()) for _ in range(n-(n-s))]
# k = 0
# d = 0
# n0,n1 = 0,0
# for i in range(s,n):
#     a.append(int(input()))
#     if a[0] % 2 == 0:
#         n0 = a[0]
#     if a[0] % 2 != 0:
#         n1 = a[0]
#     if a[i] % 2 == 0:
#         k = n1 + a[i]
#     elif a[i] % 2 != 0:
#         k = n0 + a[i]
#     if k > d:
#         d = k
#     for j in range(len(a)):
#         a[j-1] = a[j]
# print(d)
#
# n10,n5,n2 = 0,0,0
# a = [2,6,5,15]
# n = 4
# for i in range(n):
#     if a[i] % 10 == 0:
#         n10 += 1
#     elif a[i] % 5 == 0:
#         n5 += 1
#     elif a[i] % 2 == 0:
#         n2 += 1
# print((n10*(n10-1))//2 + n2*n5 + n10*(len(a)-n10))
#
#
# n0,n1,n2 = 0,0,0
# n = 6
# k = 0
# d = 0
# a = [100,8,33,145,19,84,153]
# for i in range(1,n):
#     if a[0] % 3 == 0:
#         n0 = a[0]
#     if a[0] % 3 == 1:
#         n1 = a[0]
#     if a[0] % 3 == 2:
#         n2 = a[0]
#     if a[i] % 3 == 0:
#         k = a[i] + n0
#     elif a[i] % 3 == 1:
#         k = a[i] + n2
#     elif a[i] % 3 == 2:
#         k = a[i] + n1
#     if k > d:
#         d = k
#     for j in range(len(a)):
#         a[j-1] = a[j]
# print(d)
#
# n0,n02,n56,n562,max = 0,0,0,0,0
# n = 112
# a = [0]*112
# for i in range(n):
#     a[i] = 0
#     for j in range(1,n):
#         x = int(input())
#         a[x % 112] = x
#         if x % 112 == 0:
#             n02 = n0
#             n0 = x
#         if x % 56 == 0:
#             n562 = n56
#             n56 = x
# for i in range(1,56):
#     if a[i] + a[112-i] > max:
#         max = a[i] + a[112-i]
# if n0 + n02 > max:
#     max = n0 + n02
# if n56 + n562 > max:
#     max = n56 + n562
# print(max)
#
# n0,n02,n3,n32 = 0,0,0,0
# max = 0
# n = 6
# a = []
# for i in range(n):
#     a.append(0)
# for j in range(1,n):
#     x = int(input())
#     a[x % 6] = x
#     if x % 6 == 0:
#         n02 = n0
#         n0 = x
#     if x % 3 == 0:
#         n32 = n3
#         n3 = x
# for i in range(1,4):
#     if a[i] + a[6-i] > max:
#         max = a[i] + a[6-i]
# if n0 + n02 > max:
#     max = n0 + n02
# if n3 + n32 > max:
#     max = n3 + n32
# print(max)
#
#
#
# a = [115,46,80,1,5]
# a = []
# n0,n02,n3,n32 = 0,0,0,0
# max = 0
# n = 6
# a = []
# for i in range(115):
#     a.append(0)
# for j in range(1,n):
#     x = int(input())
#     a[x % 115] = x
#     if x % 5 == 0:
#         n02 = n0
#         n0 = x
#     if x % 23 == 0:
#         n32 = n3
#         n3 = x
# for i in range(1,24):
#     if a[i] + a[115-i] > max:
#         max = a[i] + a[115-i]
# if n0 + n02 > max:
#     max = n0 + n02
# if n3 + n32 > max:
#     max = n3 + n32
# print(max)
#
#
# n = int(input())
#
#
# def func(n):
#     if n <= 2:
#         return 0, n
#     elif n <= 5 and n > 2:
#         return 0, 2
#     else:
#         c = n // 5
#         while n >= 5:
#             n -= 5
#         return n, c*2
#
#
# print(' '.join([str(i) for i in func(n)]))
#
#
# def max(n):
#     c = 0
#     if n > 5:
#         j = (n // 5)+1
#         for _ in range(j):
#             if n > 5:
#                 n -= 5
#                 if n >= 2:
#                     c += 2
#                     n -= 2
#                 else:
#                     c += n
#             else:
#                 if n < 2:
#                     c += n
#                 else:
#                     c += 2
#         return c
#         # while n > 5:
#         #     n -= 5
#         #     c += 2
#         #     n -= 2
#         # return c
#     elif n <= 5 and n > 2:
#         return 2
#     else:
#         return n
#
# def min(n):
#     c = 0
#     if n <= 2:
#         return 0
#     elif n <= 5 and n > 2:
#         return 0
#     else:
#         j = (n // 5) + 1
#         for _ in range(j - 1):
#             if n >= 5:
#                 n -= 5
#                 if n >= 2:
#                     c += 2
#                     n -= 2
#                 else:
#                     c += n
#             else:
#                 break
#         return c
#
# print(min(n), max(n))
#
#

# n = int(input())
# a = [input() for _ in range(n)]
# for i in range(n):
#     if len(a[i]) <= 10:
#         print(a[i])
#     else:
#         s = []
#         c = 0
#         s.append(a[i][0])
#         s.append(str(len(a[i])-2))
#         s.append(a[i][-1])
#         print("".join(s))

# n = int(input())
# while(n > 0):
#     s = input()
#     if len(s) <= 10:
#         print(s)
#     else:
#         print(s[0]+str(len(s)-2)+s[-1])

# n = int(input())
# a = [input() for _ in range(n)]
# c = 0
# for i in a:
#     if i in ("++X","X++"):
#         c += 1
#     else:
#         c -= 1
# print(c)


# print('+'.join(sorted(input().split('+'))))

# n = int(input())
# a = []
# x,y = [int(i) for i in input().split()]
# c = y
# for i in range(n-1):
#     x,y = [int(i) for i in input().split()]
#     c = c - x + y
#     a.append(c)
# print(max(a))

# x,y = [int(i) for i in input().split()]
# a = [i for i in input()]
# b = 0
# flag = True
# for i in range(y):
#     for j in range(1,len(a)):
#         if flag:
#             if a[j-1] == "B" and a[j] == "G":
#                 a[j-1], a[j] = a[j], a[j-1]
#                 flag = False
#         else:
#             flag = True
#
# print("".join(a))
# a = [int(i) for i in input().split()]
#
# def binar_sort(a, find_value):
#     mid = len(a) // 2
#     low = 0
#     hight = len(a) - 1
#     lenght = hight - low
#     while lenght != 1:
#         if lenght % 2 != 0:
#             if a[mid] > find_value:
#                 hight = mid
#                 lenght = hight - low
#                 mid = lenght // 2
#             elif a[mid] < find_value:
#                 low = mid
#                 lenght = hight - low
#                 mid = lenght // 2
#             else:
#                 hight = low + 1
#                 lenght = hight - low
#                 mid = lenght // 2
#         else:
#             if a[mid] > find_value:
#                 hight = mid
#                 lenght = hight - low
#                 mid = lenght // 2
#             elif a[mid] < find_value:
#                 low = mid
#                 lenght = hight - low
#                 mid = lenght // 2
#             else:
#                 hight = low + 1
#                 lenght = hight - low
#                 mid = lenght // 2
#     print(a[hight])
#
# binar_sort(a, 10)

# a = list(map(int, input().split()))
# print("Hard") if 1 in a else print("Easy")

# x = int(input())
# j = 0
# while x - 5 >= 0:
#     x -= 5
#     j += 1
# print(j) if x == 0 else print(j+1)

# n = int(input())
# s = input()
# if s.count('A') > s.count('D'):
#     print("Anton")
# elif s.count('A') == s.count('D'):
#     print("Friendship")
# else:
#     print("Danik")

# n, h = map(int, input().split())
# j = n
# a = list(map(int, input().split()))
# for i in a:
#     if i > h: j += 1
# print(j)

# n = int(input())
# j = 0
# a = list(map(int, input().split()))
# for i in a:
#     if i < max(a):
#         j += max(a) - i
# print(j)

# n = int(input())
# a = [1 for _ in range(n)]
# for _ in range(n-1):
#     for i in range(1, n):
#         a[i] += a[i-1]
# print(a)

# j = 0
# n = int(input())
# s = list(input())
# for i in range(n-2):
#     while s[i] == s[i+1] == s[i+2] == 'x':
#         j += 1
#         s.pop(i)
#         s.append(' ')
# print(j)

# n = int(input())
# a = [input() for _ in range(n)]
# for i in range(n):
#     if len(a[i]) > 10:
#         a[i] = a[i][0] + str(len(a[i]) - 2) + a[i][-1]
# print(*a, sep="\n")

# n, k = map(int, input(). split())
# a = list(map(int, input().split()))
# i = 0
# j = len(a) - 1
# count = 0
# while True:
#     if j != -1 and a[i] <= k:
#         a.pop(i)
#         count += 1
#         j -= 1
#     elif j != -1 and a[j] <= k:
#         a.pop(j)
#         count += 1
#         j -= 1
#     else:
#         break
# print(count)

n, m, z = map(int, input().split())
n_arr = [i * n for i in range(1, z + 1) if (i * n) <= z]
m_arr = [i * m for i in range(1, z + 1) if (i * m) <= z]
count = 0
for i in n_arr:
    if i in m_arr:
        count += 1
print(count)
