PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000033. Thời điểm các đồng hồ cùng trở về vị trí đầu (Multiple Clocks)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Thời điểm các đồng hồ cùng trở về vị trí đầu (Multiple Clocks)
Multiple Clocks
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
There are clocks. The hand of clock completes one full turn in exactly seconds. All hands start pointing upward, and the clocks start simultaneously. Find the smallest positive number of seconds until all hands point upward again.
Input
The first line contains . Each of the following lines contains .
Output
Print the minimum positive time.
Subtasks
- Subtask 1 (20 points): ; ;
- Subtask 2 (30 points): ; ;
- Subtask 3 (50 points): ; ;
Examples
Input
2
2
3
Output
6
Explanation
The first clock returns every seconds and the second every seconds; both first coincide at second .