#include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i)) using ll = long long; const int V = 50; const int C = 301; const int E = 1500; const int inf = 1e8; ll dp[V][C]; ll a[E], b[E], t[E], cost[E]; int main() { ll v, m, e; cin >> v >> m >> e; v--; rep(i, e) cin >> a[i], a[i]--; rep(i, e) cin >> b[i], b[i]--; rep(i, e) cin >> cost[i]; rep(i, e) cin >> t[i]; rep(i, V) rep(j, C) dp[i][j] = inf; dp[0][0] = 0; for (int i=0; i<v; ++i) { for (int j=0; j<e; ++j) { for (ll k=cost[j]; k<=m; ++k) { dp[b[j]][k] = min(dp[b[j]][k], dp[a[j]][k - cost[j]] + t[j]); } } } ll res = inf; rep(i, m+1) { res = min(res, dp[v][i]); } cout << (res == inf ? -1 : res) << endl; }