class Solution {
    public long solution(int n, int[] times) {
        return binarySearch(n, times);
    }

    private static long binarySearch(int targetNumber, int[] times){
        long start = 1;
        //이거 어떻게 정하면되지...끝을?
        long end = 1000000000000000000L; //최대사람수 * 심사관1명이고 심사걸리는 시간 최대로 하면됨
        
        while(start < end){
            long mid = (start + end)/2;
            
            long judgedNumber = extractJudgedNumber(mid, times);
            if(targetNumber > judgedNumber){
                start = mid+1;
            }else{
                end = mid;
            }
        }
        return start;
    }

    private static long extractJudgedNumber(long nowTime, int[] times){
        long count = 0;
        for(int time : times){
            count += (nowTime/time) ;
        }
        return count;
    }

}