#include <bits/stdc++.h>
int solve_k(int time[], int minutes, int n_now, int n, int count, int k) {
  for (int i = 0; i < k; ++i) {
    bool start = true;
    for (int j = n_now; j < n; ++j) {
      if (minutes - time[i] < 0) {
        start = false;
        break;
      }
      minutes -= time[i];
      ++count;
    }
    if (!start) break;
  }
  return count;
}
int solve_n(int time[], int minutes, int n, int k) {
  int count = 0;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    bool start = true;
    int check = solve_k(time, minutes, i, n, count, k);
    ans = std::max({check, ans, count});
    for (int j = 0; j < k; ++j) {
      if (minutes - time[j] < 0) {
        start = false;
        break;
      }
      minutes -= time[j];
      ++count;
    }
    count += start;
  }
  return ans;
}
int main() {
  int n, k, m;
  std ::cin >> n >> k >> m;
  int time[k];
  for (int i = 0; i < k; ++i) {
    std::cin >> time[i];
  }
  std::sort(time, time + k);
  int ans_1 = 0, ans_2 = 0;
  int minutes = m;
  for (int i = 0; i < n; ++i) {
    bool start = true;
    for (int j = 0; j < k; ++j) {
      if (minutes - time[j] < 0) {
        start = false;
        break;
      }
      minutes -= time[j];
      ++ans_1;
    }
    ans_1 += start;
  }
  int ans_3 = solve_n(time, m, n, k);
  std::cout << std::max({ans_1, ans_3});
}
