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

typedef ostringstream OSS;
typedef istringstream ISS;

typedef long long LL;
typedef pair<int, int> PII;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<double> VD;
typedef vector<VD> VVD;
typedef vector<string> VS;
typedef vector<VS> VVS;
typedef vector<bool> VB;
typedef vector<VB> VVB;
typedef vector<PII> VPII;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x) (x).begin(),(x).end()
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a) { OSS oss; oss << a; return oss.str(); };

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int N, M, C, S, G;

struct Edge {
    Edge(){}
    Edge (int t, int d, int c) :
        to(t), dist(d), company(c) {}
    int to, dist, company;
};

struct State {
    State () {}
    State (int v_, int p, int d, int c) :
        v(v_), price(p), dist(d), company(c) {}
    int v, price, dist, company;

    bool operator > (const State &s) const {
        return price > s.price;
    }
};

vector<vector<Edge>> es;
VI ps;
VVI qs, rs;
VVI sum_ps;

VI calc_sum_ps_one(int c) {
    VI sum;
    sum.PB(0);

    int d = 1;
    for (int i = 0; i < ps[c] - 1; i++) {
        while (d <= qs[c][i]) {
            sum.PB(sum.back() + rs[c][i]);
            ++d;
        }
    }

    return sum;
}

int calc_price(int d, int c) {
    if (d < (int)sum_ps[c].size()) {
        return sum_ps[c][d];
    } else {
        return sum_ps[c].back() + (d - sum_ps[c].size() + 1) * rs[c].back();
    }
}

int solve() {
    // ?´???????????±?????????????
    sum_ps.clear();
    sum_ps.resize(C + 1);
    for (int i = 1; i <= C; i++) {
        sum_ps[i] = calc_sum_ps_one(i);
    }

    // ????????????????????????
    
    // dists[v][c][d] = min_price;
    const int MAX_DIST = 210;
    VVVI dists(N, VVI(C + 1, VI(MAX_DIST + 1, INF)));
    dists[S][0][0] = 0;

    priority_queue<State, vector<State>, greater<State>> q;
    q.push(State(S, 0, 0, 0));

    while (q.size()) {
        State cur = q.top();
        q.pop();

        // ????°?????????????
        if (dists[cur.v][cur.company][min(cur.dist, MAX_DIST)] < cur.price) continue;

        for (auto &e : es[cur.v]) {
            State next;
            next.v = e.to;
            next.company = e.company;
            
            if (next.company != cur.company) {
                next.dist = e.dist;
                next.price = cur.price + calc_price(next.dist, next.company);
            } else {
                next.dist = cur.dist + e.dist;
                next.price = cur.price + calc_price(next.dist, next.company) - calc_price(cur.dist, cur.company);
            }

            if (dists[next.v][next.company][min(next.dist, MAX_DIST)] > next.price) {
                dists[next.v][next.company][min(next.dist, MAX_DIST)] = next.price;
                q.push(next);
            }
        }
    }

    int ans = INF;
    for (int c = 0; c <= C; c++) {
        for (int d = 0; d <= MAX_DIST; d++) {
            int t = dists[G][c][d];
            ans = min(ans, t);
        }
    }

    return ans == INF ? -1 : ans;
}

int main(void) {
    while (cin >> N >> M >> C >> S >> G, N) {
        --S; --G;

        es.clear();
        es.resize(N);
        for (int i = 0; i < M; i++) {
            int x, y, d, c;
            cin >> x >> y >> d >> c;
            --x; --y;
            es[x].EB(y, d, c);
            es[y].EB(x, d, c);
        }

        ps.clear();
        ps.resize(C + 1);
        for (int i = 1; i <= C; i++) {
            cin >> ps[i];
        }

        qs.clear();
        qs.resize(C + 1);
        rs.clear();
        rs.resize(C + 1);
        for (int i = 1; i <= C; i++) {
            qs[i].clear();
            qs[i].resize(ps[i] - 1);
            for (auto &q : qs[i]) cin >> q;

            rs[i].clear();
            rs[i].resize(ps[i]);
            for (auto &r : rs[i]) cin >> r;
        }

        cout << solve() << endl;
    }

	return 0;
}

Measured memory_bytes: 7632