import java.util.Arrays;
class Solution {
public long solution(int n, int[] times) {
Arrays.sort(times);
long R= (long)times[times.length-1]*(long)n;
long L= 1;
while(L<=R){
long mid=(L+R)/2;
long count=0;
for(int i=0; i<times.length; i++ ){
count+=mid/times[i];
}
if(count>=n){
R=mid-1;
}else{
L=mid+1;
}
}
return L;
}
}