#include "bits/stdc++.h"
#define YES "YES"
#define Yes "Yes"
#define NO "NO"
#define No "No"
#define YESNO OUT(three(solve(),YES,NO))
#define YesNo OUT(three(solve(),Yes,No))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(a);i>=(LL)(b);i--)
#define REP(i,b) FOR(i,zero,b)
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,b-1,zero)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB emplace_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define int long long
#define zero 0LL
#define pb PB
using namespace std;
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef long long LL;
typedef long double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr, Vpr, greater<pr> > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
int dx[] = { 0,1,0,-1,1,1,-1,-1,0 }, dy[] = { 1,0,-1,0,1,-1,1,-1,0 };
const int SIZE1 = 1e4 + 1000;
const int SIZE2 = 1010;
const int SIZE3 = 188;
const int SIZE = SIZE1;
const LL p = 7 + 1e9;
const LL INF = 1LL << 58;
const long double EPS = 1e-7;
int L;
int N,M,C,S,G,P[SIZE];
typedef tuple<LL,LL,LL> tp3;
LL dist[101][101];
LL cost[101][101];
LL input[101][101][21];
const int MAXIM=3e5;
LL costFromDist[MAXIM][20];
LL calc(int d,int c){
	if(d>=INF/2) return INF;
//	cout <<d << " "<< costFromDist[d][c] << endl;
	return costFromDist[d][c];
}
LL solve(){
	REP(i,101) REP(j,101){
		dist[i][j]=0;
		cost[i][j]=INF;
		REP(k,21)
			input[i][j][k]=INF;
	}
	REP(i,101) cost[i][i]=0;
	FOR(i,1,MAXIM) REP(j,20) costFromDist[i][j]=INF;
	cin >> N>> M >> C >> S >> G;
	if(N==0) return 1;
	REP(i,101) REP(j,101) REP(c,C) input[i][j][c]=INF;
	REP(i,M){
		int x,y,d,c;
		cin >> x >> y >> d >> c;
		x--;y--;
		c--;
		MN(input[x][y][c],d);
		MN(input[y][x][c],d);
	}
	REP(i,C){
	//	cout <<"OK"<<endl;
		cin >> P[i];
	}
	REP(c,C){
	//	cout <<"OK"<<endl;
		VI q(P[c]-1),r(P[c]);
		int now=0;
		int ndist=0;
		int cost=0;
		REP(i,P[c]-1) cin >> q[i];
		REP(i,P[c]) cin >> r[i];
		q.pb(25000);
		//cout <<"A" << q.size() <<endl;
		REP(i,q.size()){
			while(ndist<q[now]){
				cost+=r[now];
				ndist++;
				costFromDist[ndist][c]=cost;
			}
		//	cout << "B" << costFromDist[ndist][c] << endl;
			now++;
		}
	}
	REP(c,C){
		REP(i,N) REP(j,N) dist[i][j]=input[i][j][c];
		REP(i,N) dist[i][i]=0;
		REP(ll,3) REP(i,N) REP(j,N) REP(k,N) MN(dist[i][j],dist[i][k]+dist[k][j]); 
		REP(i,N) REP(j,N) MN(cost[i][j],calc(dist[i][j],c));

	}

	REP(ll,3) REP(i,N) REP(j,N) REP(k,N) MN(cost[i][j],cost[i][k]+cost[k][j]);
	if(cost[S-1][G-1]>=INF) cout << -1<<endl;
	else cout << cost[S-1][G-1] << endl;
	return 0;
}
signed main(){
	while(solve()==0){
	}

}


Measured memory_bytes: 51828