#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
template<class T>
struct graph{
    struct edge{
        int to;
        T cost;
        edge(int to, T cost) : to(to), cost(cost){}
        bool operator<(const edge& r)const { return cost < r.cost; }
    };
    int V;
    vector< vector< edge > > adj;
    vector< T > dist;
    vector< int > prev;

    graph(int n = 0){
        init(n);
    }

    void init(int size){
        V = size;
        adj.assign(size, vector<edge>());
    }

    void add_edge(int from, int to, T cost){
        adj[from].push_back(edge(to, cost));
    }

    void Dijkstra(int from, T inf){
        using P = pair<T, int>;
        priority_queue< P, vector<P>, greater<P> > q;
        dist.assign(V, inf);
        prev.assign(V, -2);
        dist[from] = 0;
        prev[from] = -1;
        q.push(P(0, from));
        while(!q.empty()){
            P p = q.top();
            q.pop();
            int v = p.second;
            if(dist[v] < p.first) continue;
            for(edge e: adj[v]){
                if(dist[v] + e.cost < dist[e.to]){
                    dist[e.to] = dist[v] + e.cost;
                    prev[e.to] = v;
                    q.push(P(dist[e.to], e.to));
                }
            }
        }
    }

    void get_path(int to, vector<int>& path){
        path.clear();
        if(prev[to] == -2) return;
        while(prev[to] != -1){
            path.push_back(to);
            to = prev[to];
        }
        path.push_back(to);
        reverse(path.begin(), path.end());
    }

    void print_path(int to){
        vector< int > path;
        get_path(to, path);
        cout << "path: " << endl;
        for(int i: path) cout << i << " ( " << dist[i] << " )" << endl;
    }
};

int main(void){
    int n, m;
    cin >> n >> m;
    vector< vector< int > > a(n, vector< int >(m));
    vector< vector< int > > b(n, vector< int >(m));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m-1; j++){
            cin >> a[i][j];
        }
    }
    for(int i = 0; i < n-1; i++){
        for(int j = 0; j < m; j++){
            cin >> b[i][j];
        }
    }

    graph< int > g(n*m);
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            int id = i * m + j;
            if(j+1 < m) g.add_edge(id, i*m + j+1, a[i][j]);
            if(j > 0) g.add_edge(id, i*m + j-1, a[i][j-1]);
            if(i+1 < n) g.add_edge(id, (i+1)*m + j, b[i][j]);
            for(int k = 0; k < i; k++) g.add_edge(id, k*m + j, i-k+1);
        }
    }
    g.Dijkstra(0, 1e9);
    cout << g.dist[n*m-1] << endl;
}

#include <iostream>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
ll d[20][200010],dp[1<<20][20];
vector<int> G[100010];
queue<pair<int,int>> que;
void bfs(int s,int t){
    que.push({0,s});
    while(que.size()){
        pair<int,int> p = que.front();
        que.pop();
        if(d[t][p.second]!=-1) continue;
        d[t][p.second] = p.first;
        for(int v:G[p.second]) que.push({p.first + 1,v});
    }
}

int a[100010],b[100010],c[200];
int main(){
    int i,j,l,n,m; cin >> n >> m;
    for(i=0;i<m;i++){
        cin >> a[i] >> b[i]; a[i]--; b[i]--;
        G[a[i]].push_back(b[i]); G[b[i]].push_back(a[i]);
    }
    int k; cin >> k;
    for(i=0;i<k;i++){
        cin >> c[i]; c[i]--;
        for(j=0;j<n;j++) d[i][j] = -1;
        bfs(c[i],i);
    }
    /*for(i=0;i<k;i++){
        for(j=0;j<n;j++) cout << d[i][j] << " ";
        cout << endl;
    }*/
    ll inf = 100000000000;
    for(i=0;i<(1<<k);i++){
        for(j=0;j<k;j++) dp[i][j] = inf;
    }
    for(i=0;i<k;i++) dp[1<<i][i] = 1;
    for(i=0;i<(1<<k);i++){
        for(j=0;j<k;j++){
            if(i>>j&1){
                for(l=0;l<k;l++){
                    if(l==j) continue;
                    if(i>>l&1 && d[l][c[j]]!=-1){
                       // cout << i << " " << j << " " << l << " " << dp[i][j] << " " << dp[i^(1<<j)][l] << " " << d[l][c[j]] << endl;
                        dp[i][j] = min(dp[i][j],dp[i^(1<<j)][l] + d[l][c[j]]);
                    }
                }
            }
        }
    }
    /*for(i=0;i<(1<<k);i++){
        for(j=0;j<k;j++) cout << dp[i][j] << " ";
        cout << endl;
    }*/
    ll ans = inf;
    for(i=0;i<k;i++){
        ans = min(ans,dp[(1<<k) - 1][i]);
    }
    if(ans==inf){
        cout << -1 << endl;
    }else{
        cout << ans << endl;
    }
}