#include <bits/stdc++.h>
using namespace std;
const int N = 10000;
int n;
bool mem[N][N];
class ad {
   public:
    int a, b, c, d, r, id;
    ad() {}
    void read() {
        scanf("%d%d%d", &a, &b, &r);
        mem[a][b] = true;
        c = a + 1, d = b + 1;
    }
    void print() { printf("%d %d %d %d\n", a, b, c, d); }
    int size;
    void cal_size() { size = (c - a) * (d - b); }
    double grad0, grad1;
    void cal_grad() {
        double p1 = 1.0 * size, p2 = size + d - b, p3 = size + c - a;
        p1 = min(p1 / r, r / p1), p2 = min(p2 / r, r / p2),
        p3 = min(p3 / r, r / p3);
        p1 = p1 * (2 - p1), p2 = p2 * (2 - p2), p3 = p3 * (2 - p3);
        grad0 = p2 - p1, grad1 = p3 - p1;
    }
    void init() {
        cal_size();
        cal_grad();
    }
    bool extend0() {
        if (a) {
            bool f = true;
            for (int j = b; j < d; ++j) {
                if (mem[a - 1][j]) {
                    f = false;
                    break;
                }
            }
            if (f) {
                for (int j = b; j < d; ++j) mem[a - 1][j] = true;
                --a;
                init();
                return true;
            }
        }
        if (c < 9999) {
            bool f = true;
            for (int j = b; j < d; ++j) {
                if (mem[c][j]) {
                    f = false;
                    break;
                }
            }
            if (f) {
                for (int j = b; j < d; ++j) mem[c][j] = true;
                ++c;
                init();
                return true;
            }
        }
        return false;
    }
    bool extend1() {
        if (b) {
            bool f = true;
            for (int i = a; i < c; ++i) {
                if (mem[i][b - 1]) {
                    f = false;
                    break;
                }
            }
            if (f) {
                for (int i = a; i < c; ++i) mem[i][b - 1] = true;
                --b;
                init();
                return true;
            }
        }
        if (d < 9999) {
            bool f = true;
            for (int i = a; i < c; ++i) {
                if (mem[i][d]) {
                    f = false;
                    break;
                }
            }
            if (f) {
                for (int i = a; i < c; ++i) mem[i][d] = true;
                ++d;
                init();
                return true;
            }
        }
        return false;
    }
    bool operator<(const ad &rhs) const {
        return max(grad0, grad1) > max(rhs.grad0, rhs.grad1);
    }
};
priority_queue<ad> q;
ad ans[200];
int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        ad t;
        t.read();
        t.id = i;
        t.init();
        q.push(t);
    }
    while (!q.empty()) {
        ad now = q.top();
        q.pop();
        bool f = false;
        if (now.grad0 >= now.grad1 && now.grad0 > 0) {
            if (now.extend0())
                f = true;
            else if (now.grad1 > 0 && now.extend1())
                f = true;
        }
        if (now.grad1 > now.grad0 && now.grad1 > 0) {
            if (now.extend1())
                f = true;
            else if (now.grad0 > 0 && now.extend0())
                f = true;
        }
        if (f)
            q.push(now);
        else
            ans[now.id] = now;
    }
    for (int i = 0; i < n; ++i) ans[i].print();
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n,k,m;
  cin>>n>>k>>m;
  int a;
  int sum=0;
  rep(i,n-1){
    cin>>a;
    sum+=a;
  }
  int ans=(m*n)-sum;
  if(ans>k) cout<<-1<<endl;
  else cout<<max(ans,(int)0)<<endl;
  

  return 0;
}
