#include <bits/stdc++.h>   using namespace std;   int n, k, m;   int arr[50];   int sub[50];   int result = 0;   int task_tot_time = 0;   void take(int score, int t) {     if (0 >= t) return;     int tt = t;     int ss = score;     for (decltype(0) i = 0; i < k; i++) {       int su = sub[i];       while (su > 0) {         if (arr[i] > tt) break;         ss++;         tt -= arr[i];         su--;       }     }     result = max(result, ss);     if (t >= task_tot_time) {       int task_left = sub[0];       for (decltype(1) i = 1; i < k; i++) task_left = min(task_left, sub[i]);       if (task_left == 0) return;       for (decltype(0) i = 0; i < k; i++) sub[i]--;       result = max(result, score + k + 1);       take(score + k + 1, t - task_tot_time);     }   }   int main() {     scanf( %d , &n) == 0, scanf( %d , &k) == 0, scanf( %d , &m) == 0;     for (decltype(0) i = 0; i < k; i++) {       scanf( %d , &arr[i]) == 0;       task_tot_time += arr[i];     }     for (decltype(0) i = 0; i < k; i++) sub[i] = n;     sort(arr, arr + k);     take(0, m);     printf( %d , result);   }   