#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for(int i=0; i<n; i++)
#define FOR(i,a,b) for(int i=a; i<b; i++)
#define FORR(i,a,b) for(int i=(int)b-1; i>=a; i--)

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))

int n,m,c,s,t;
int g[25][125][125];
const int INF = 1<<28;
int p[25];
int q[52];
int r[52];
int di[25252];

int main(){
    while(true){
        cin>>n>>m>>c>>s>>t;
        if(n+m+c+s+t==0)break;
        REP(i,c+1)REP(j,n)REP(k,n)g[i][j][k] = INF;
        REP(_,m){
            int x,y,a,b;
            cin>>x>>y>>a>>b;
            b--;x--;y--;
            g[b][y][x] = min(g[b][y][x], a);
            g[b][x][y] = g[b][y][x];
        }
        REP(i,c)scanf("%d",p+i);
        REP(x,c){
            // WF
            REP(k,n)REP(i,n)REP(j,n)CHMIN(g[x][i][j], g[x][i][k]+g[x][k][j]);
            // dist
            REP(i,p[x]-1)scanf("%d",q+i);
            q[p[x]-1] = 25252;
            REP(i,p[x])scanf("%d",r+i);
            di[0] = 0;
            int it = 0;
            FOR(i,1,25252){
                di[i] = di[i-1] + r[it];
                if(i == q[it]){
                    it++;
                }
            }
            // g
            REP(i,n)REP(j,n)if(g[x][i][j]<INF/2){
                // printf("%d: %d->%d = %d(%d)\n",x,i,j,di[g[x][i][j]],g[x][i][j]);
                CHMIN(g[c][i][j], di[g[x][i][j]]);
            }
        }
        // total
        REP(k,n)REP(i,n)REP(j,n)CHMIN(g[c][i][j], g[c][i][k]+g[c][k][j]);
        int ans = g[c][s-1][t-1];
        if(ans>INF/2){
            puts("-1");
        }else{
            cout << g[c][s-1][t-1] << endl;
        }
    }
    return 0;
}
