#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <cstdio>

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) (v).begin(), (v).end()
#define REV(s) (s).rbegin(), (s).rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define MP make_pair
#define MT make_tuple
#define X first
#define Y second

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const int N = 110;
const ll INF = 1ll << 60;
ll G[25][N][N];
ll cost[N][N];

ll p[55], q[55], r[55];

ll calc(int i, ll d){
	if (i < 0) return 0;
	return r[i] * max(d - q[i], 0ll) + calc(i-1, min(d, q[i]));
}

int main(){
	int n, m, c, s, g;
	while (cin >> n >> m >> c >> s >> g , n|m|c|s|g){
		rep(i, n) rep(j, n) if (i != j) cost[i][j] = INF;
		rep(i, c) rep(j, n) rep(k, n) G[i][j][k] = INF;
		rep(i, m){
			int x, y, d, cc;
			cin >> x >> y >> d >> cc;
			--x, --y, --cc;
			G[cc][x][y] = G[cc][y][x] = min((ll)d, G[cc][x][y]);
		}

		rep(cc, c) rep(i, n) rep(j, n) rep(k, n) G[cc][j][k] = min(G[cc][j][k], G[cc][j][i] + G[cc][i][k]);
		rep(cc, c) cin >> p[cc];
		rep(cc, c){
			rep(i, p[cc]-1) cin >> q[i+1];
			rep(i, p[cc]) cin >> r[i];
			rep(i, n) rep(j, n){
				if (G[cc][i][j] == INF) continue;
				cost[i][j] = min(cost[i][j], calc(p[cc] - 1, G[cc][i][j]));
			}
		}
		rep(i, n) rep(j, n) rep(k, n) cost[j][k] = min(cost[j][k], cost[j][i] + cost[i][k]);
		ll ans = cost[s - 1][g - 1];
		if (ans == INF) ans = -1;
		//cout << "***";
		cout << ans << endl;
	}

	return 0;
}