#include <bits/stdc++.h>   using namespace std;   const static int maxN = 1000;   struct {     int r, c;   } tooth[maxN];   int toothrow[maxN + 1];   int main() {     int n, m, k;     int i;     int ans;     while (scanf( %d%d%d , &n, &m, &k) != EOF) {       for (i = 0; i < n; i++) {         scanf( %d%d , &tooth[i].r, &tooth[i].c);       }       memset(toothrow, -1, sizeof(int) * (m + 1));       ans = 0;       for (i = 0; i < n; i++) {         if (toothrow[tooth[i].r] != -1) {           if (tooth[i].c < toothrow[tooth[i].r]) {             ans -= toothrow[tooth[i].r];             ans += tooth[i].c;             toothrow[tooth[i].r] = tooth[i].c;           }         } else {           ans += tooth[i].c;           toothrow[tooth[i].r] = tooth[i].c;         }       }       printf( %d n , min(ans, k));     }     return 0;   }   