#include using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() template inline bool chmax(A &a, B b) { if (a inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; } typedef unsigned long long ull; typedef long long ll; typedef pair pii; typedef pair pll; typedef pair P; const ll INF = 1ll<<29; const ll MOD = 1000000007; const double EPS = 1e-10; int n, c, v; int s[1500], t[1500], y[1500], m[1500]; int dp[301][50]; int main() { cin >> n >> c >> v; REP(i, v) { scanf("%d", s + i); s[i]--; } REP(i, v) { scanf("%d", t + i); t[i]--; } REP(i, v) scanf("%d", y + i); REP(i, v) scanf("%d", m + i); fill(dp[0], dp[c + 1], INF); dp[0][0] = 0; REP(i, c + 1) REP(j, n) { if (dp[i][j] == INF) continue; REP(k, v) if (s[k] == j) { if (i + y[k] > c) continue; chmin(dp[i + y[k]][t[k]], dp[i][j] + m[k]); } } int ans = INF; REP(i, c + 1) chmin(ans, dp[i][n - 1]); if (ans == INF) puts("-1"); else cout << ans << endl; return 0; }