Problem: Saving electricity is very important!

You are in the office represented as R \times C grid that consists of walls and rooms. It is guaranteed that, for any pair of rooms in the office, there exists exactly one route between the two rooms. It takes 1 unit of time for you to move to the next room (that is, the grid adjacent to the current room). Rooms are so dark that you need to switch on a light when you enter a room. When you leave the room, you can either leave the light on, or of course you can switch off the light. Each room keeps consuming electric power while the light is on.

Today you have a lot of tasks across the office. Tasks are given as a list of coordinates, and they need to be done in the specified order. To save electricity, you want to finish all the tasks with the minimal amount of electric power.

The problem is not so easy though, because you will consume electricity not only when light is on, but also when you switch on/off the light. Luckily, you know the cost of power consumption per unit time and also the cost to switch on/off the light for all the rooms in the office. Besides, you are so smart that you don't need any time to do the tasks themselves. So please figure out the optimal strategy to minimize the amount of electric power consumed.

After you finished all the tasks, please DO NOT leave the light on at any room. It's obviously wasting!



Input

The first line of the input contains three positive integers R (0 \lt R \leq 50), C (0 \lt C \leq 50) and M (2 \leq M \leq 1000). The following R lines, which contain C characters each, describe the layout of the office. '.' describes a room and '#' describes a wall.

This is followed by three matrices with R rows, C columns each. Every elements of the matrices are positive integers. The (r, c) element in the first matrix describes the power consumption per unit of time for the room at the coordinate (r, c). The (r, c) element in the second matrix and the third matrix describe the cost to turn on the light and the cost to turn off the light, respectively, in the room at the coordinate (r, c).

Each of the last M lines contains two positive integers, which describe the coodinates of the room for you to do the task.

Note that you cannot do the i-th task if any of the j-th task (0 \leq j \leq i) is left undone.

Output

Print one integer that describes the minimal amount of electric power consumed when you finished all the tasks.

Examples

Input

1 3 2
...
1 1 1
1 2 1
1 1 1
0 0
0 2


Output

7


Input

3 3 5
...
.##
..#
1 1 1
1 0 0
1 1 0
3 3 3
3 0 0
3 3 0
5 4 5
4 0 0
5 4 0
1 0
2 1
0 2
2 0
0 0


Output

77


Input

5 5 10
.###
....
.#
..#.#
....
0 12 0 0 0
0 4 3 2 10
0 0 0 99 0
11 13 0 2 0
0 1 1 2 1
0 4 0 0 0
0 13 8 2 4
0 0 0 16 0
1 1 0 2 0
0 2 3 1 99
0 2 0 0 0
0 12 2 12 2
0 0 0 3 0
4 14 0 16 0
0 2 14 2 90
0 1
3 0
4 4
1 4
1 1
4 4
1 1
4 3
3 0
1 4


Output

777

Solution (in CPP):

Solution:
# 2 "2302.cpp"
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>


namespace solution {
   using namespace std;

   typedef istringstream ISS;
   typedef ostringstream OSS;
   typedef vector<string> VS;
   typedef long long LL;
   typedef int INT;
   typedef vector<INT> VI;
   typedef vector<VI> VVI;
   typedef pair<INT, INT> II;
   typedef vector<II> VII;

   ostream& operator << ( ostream& os, II& p ) {
      os << "(" << p.first << "," << p.second << ")";
      return os;
   }

   const int SIZE = 51;
   const int MAX_M = 1011;
   const int NONE = -1;
   const char WALL = '#';
   int H, W, M;
   string S[SIZE];
   int X[SIZE][SIZE];
   int Y[SIZE][SIZE];
   int Z[SIZE][SIZE];
   II D[MAX_M];
   int T[SIZE][SIZE][MAX_M];
   int TC[SIZE][SIZE];
   int A;

   class Node {
   public:
      int r;
      int c;
      Node(){}
      Node(int r, int c): r(r), c(c) {}
   };
   typedef queue<Node> Queue;
   const int dr[4] = { 0, 0, 1, -1 };
   const int dc[4] = { 1, -1, 0, 0 };

   void bfs( int sr, int sc, int gr, int gc ) {
      Queue Q;
      Q.push( Node( sr, sc ) );

      II P[H][W];
      for ( int i = 0; i < H; ++ i ) {
         for ( int j = 0; j < W; ++ j ) {
            P[i][j] = II( NONE, NONE );
         }
      }

      while ( ! ( Q.empty() ) ) {
         Node node = Q.front();
         Q.pop();

         int r = node.r;
         int c = node.c;

         if ( r == gr && c == gc ) {
            VII route;
            while ( r != sr || c != sc ) {
               route.push_back( II( r, c ) );
               int pr = P[r][c].first;
               int pc = P[r][c].second;
               r = pr;
               c = pc;
            }
            reverse( route.begin(), route.end() );
            for ( VII::iterator it_i = route.begin(); it_i != route.end(); ++ it_i ) {
               int r = (*it_i).first;
               int c = (*it_i).second;
               T[r][c][TC[r][c]++] = A ++;
            }
            return;
         }

         for ( int i = 0; i < 4; ++ i ) {
            int nr = r + dr[i];
            int nc = c + dc[i];
            if ( nr < 0 || nr >= H || nc < 0 || nc >= W ) continue;
            if ( P[nr][nc].first != NONE ) continue;
            if ( S[nr][nc] == WALL ) continue;
            P[nr][nc] = II( r, c );
            Q.push( Node( nr, nc ) );
         }
      }
   }

   class Solution {
   private:
      void init() {
         for ( int i = 0; i < H; ++ i ) {
            for ( int j = 0; j < W; ++ j ) {
               TC[i][j] = 0;
            }
         }
         A = 0;
      }

      bool input() {
         if ( ! ( cin >> H >> W >> M ) ) return false;
         for ( int i = 0; i < H; ++ i ) {
            cin >> S[i];
         }
         for ( int i = 0; i < H; ++ i ) {
            for ( int j = 0; j < W; ++ j ) {
               cin >> X[i][j];
            }
         }
         for ( int i = 0; i < H; ++ i ) {
            for ( int j = 0; j < W; ++ j ) {
               cin >> Y[i][j];
            }
         }
         for ( int i = 0; i < H; ++ i ) {
            for ( int j = 0; j < W; ++ j ) {
               cin >> Z[i][j];
            }
         }
         for ( int i = 0; i < M; ++ i ) {
            cin >> D[i].first >> D[i].second;
         }
         return true;
      }

      int solve() {
         int sr = D[0].first;
         int sc = D[0].second;
         T[sr][sc][TC[sr][sc]++] = A ++;
         for ( int i = 0; i + 1 < M; ++ i ) {
            bfs( D[i].first, D[i].second, D[i+1].first, D[i+1].second );
         }

         int res = 0;
         for ( int i = 0; i < H; ++ i ) {
            for ( int j = 0; j < W; ++ j ) {
               int n = TC[i][j];
               if ( n == 0 ) continue;
               res += Y[i][j] + Z[i][j];
               for ( int k = 0; k + 1 < n; ++ k ) {
                  int d = T[i][j][k+1] - T[i][j][k];
                  res += min( X[i][j] * d, Y[i][j] + Z[i][j] );
               }
            }
         }
         return res;
      }

   public:
      int run() {
         while ( init(), input() ) {
            cout << solve() << endl;
         }
         return 0;
      }
   };
}

int main() {
   using namespace solution;
   Solution s;
   return s.run();
}