#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

const int inf = 1e9;
const ll infll = 1e18;
const int M = 1e9 + 7;
const int N = 3e6;


int fact[N+1], inv[N+1];
int mult(ll a, ll b){
	return (a * b) %M;
}
void ad(int &a, int b){
	a += b;
	if(a >= M) a -= M;
	if(a < 0) a += M;
}
int fp(int a, int b){
	int ret  = 1;
	while(b){
		if(b&1) ret = mult(ret , a);
		b >>= 1;
		a = mult(a, a);
	}
	return ret;
}
int nck(int a, int b){
	if(b > a) return 0;
	return mult(fact[a], mult(inv[b], inv[a-b]));
}
void precompute(){
	fact[0] = inv[0] = 1;
	for (int i = 1; i <= N; ++i){
		fact[i] = mult(fact[i-1], i);
		inv[i] = fp(fact[i], M - 2);
	}
}

int W , B , k;

int main(){
	precompute();
	scanf("%d%d%d", &W, &B ,&k);
	if(W >= B + k + 1) return puts("0"), 0;
	//w = b + k + 1 = bad
	int ans = nck(W+B, W);
	ad(ans , -nck(W+B, B+k+1));
	printf("%d\n",ans);
}	
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<60
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
int V;
ll G[20][20];  // グラフ
ll dp[200000][20];
int main() {
    cin >> V;
    // グラフの初期化
    rep(i, 20) {
        rep(j, 20) { G[i][j] = INF; }
    }
 
    vector<ll> x(V),y(V),z(V);
    rep(i, V) {
        cin>>x[i]>>y[i]>>z[i];
    }
    
    rep(i,V){
        rep(j,V){
            G[i][j]=abs(x[j]-x[i])+abs(y[j]-y[i])+max(0LL,z[j]-z[i]);
        }
    }
 
    // dp の初期化
    rep(i, 200000) {
        rep(j, 20) { dp[i][j] = INF; }
    }
    dp[0][0] = 0;  // スタートを頂点 0 とする
    rep(S, 1 << V) {
        rep(v, V) {
            rep(u, V) {
                if ((S & (1 << v)) == 0) {
                    if (v != u) chmin(dp[S | (1 << v)][v], dp[S][u] + G[u][v]);
                }
            }
        }
    }
    if (dp[(1 << V) - 1][0] != INF) {
        cout << dp[(1 << V) - 1][0] << endl;
    } else {
        cout << -1 << endl;
    }
    return 0;
}