#B3941. Next Group Exercise Day
Next Group Exercise Day
Next Group Exercise Day
There are \(n\) students in Xiaoyang's class. Each student has his or her own exercise habit: the \(i\)-th student exercises every \(a_i\) days. In other words, if a student exercises on day \(d\), then he or she will next exercise on day \(d + a_i\). One day, all the students happened to exercise together. Excited by this coincidence, they want to know after how many days they will all exercise together again. Help them calculate the minimum number of days before the next group exercise.
inputFormat
The first line contains a single integer \(n\) \((1 \le n \le 10^5)\), representing the number of students. The second line contains \(n\) integers \(a_1, a_2, \dots, a_n\) \((1 \le a_i \le 10^9)\), where \(a_i\) denotes the exercise interval (in days) of the \(i\)-th student.
outputFormat
Output a single integer: the minimum number of days after which all students will exercise together again.
sample
3
2 3 4
12
</p>