E: Jam

problem

There are N cities in a country, numbered 1, \ 2, \ ..., \ N. These cities are connected in both directions by M roads, and the i-th road allows you to travel between the cities u_i and v_i in time t_i. Also, any two cities can be reached by using several roads.

Bread is sold in each town, and the deliciousness of bread sold in town i is P_i.

In addition, there are K flavors of jam in this country, and in town i you can buy delicious J_i jams at taste c_i.

Homu-chan, who lives in Town 1, decided to go out to buy bread and jam one by one. Homu-chan travels through several cities, buys bread and jam, and returns to city 1. More precisely, go to city u to buy bread, select city v to buy jam, and return to city 1. At this time, u = v, u = 1, and v = 1 can be used.

The happiness of Homu-chan after shopping is "the total of the deliciousness of the bread and jam I bought"-"the time it took to move". For each of the K types of jam, calculate the maximum possible happiness when going to buy jam and bread of that taste.

Input format


NMK
P_1 P_2 ... P_N
c_1 c_2 ... c_N
J_1 J_2 ... J_N
u_1 v_1 t_1
u_2 v_2 t_2
::
u_M v_M t_M


Constraint

* 1 \ leq N \ leq 10 ^ 5
* 1 \ leq M \ leq 2 \ times 10 ^ 5
* 1 \ leq K \ leq N
* 1 \ leq P_i, J_i \ leq 10 ^ 9
* 1 \ leq c_i \ leq K
* 1 \ leq u_i, v_i \ leq N
* 1 \ leq t_i \ leq 10 ^ 9
* For all i \ (1 \ leq i \ leq K), there exists j \ (1 \ leq j \ leq N) such that c_j = i.
* Given graphs are concatenated graphs that do not include multiple edges or self-loops.
* All inputs are given as integers



Output format

Please output K line. On line i, print the maximum happiness when you go to buy bread and taste i jam.

Input example 1


4 4 3
3 6 1 6
1 1 2 3
6 1 5 5
1 2 1
2 3 1
1 3 1
1 4 1


Output example 1


Ten
8
9


* When buying taste 1 jam
* If you buy jam in city 1, move to city 2, buy bread, and come back to city 1, your happiness will be 6 + 6-2 = 10, which is optimal.
* When buying taste 2 jam
* If you move to City 2 to buy bread, move to City 3 to buy jam, and return to City 1, your happiness will be 6 + 5-3 = 8.
* When buying taste 3 jam
* If you go to City 4 and buy both bread and jam and come back to City 1, your happiness will be 6 + 5-2 = 9.



Input example 2


2 1 2
1 1
1 2
1 1
1 2 1000000000


Output example 2


2
-1999999998


* Homu-chan seems to be dissatisfied because the distance is too far compared to the deliciousness of bread and jam.



Input example 3


6 8 3
31 41 59 26 53 58
1 2 3 1 2 3
27 18 28 18 28 46
one two Three
2 3 7
2 4 8
3 6 9
3 5 3
4 5 3
1 5 15
4 6 7


Output example 3


66
61
68






Example

Input

4 4 3
3 6 1 6
1 1 2 3
6 1 5 5
1 2 1
2 3 1
1 3 1
1 4 1


Output

10
8
9
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

/* Dijkstra O(NlogM)*/

template <typename Type = int>
struct Dijkstra{
  int V;
  vector<vector<pair<int,Type>>> G;
  vector<Type> cost;

  Dijkstra(int n):
    V(n), G(n, vector<pair<int,Type>>()) {}

  void add_edge(int u, int v, Type c){
    G[u].push_back({v, c});
  }

  Type solve(int s, int g = -1){
    cost.assign(V, -1);
    priority_queue<pair<Type,int>> pq;
    Type max_cost = 0;

    pq.push({0, s});

    while(pq.size()){
      Type now_cost = pq.top().first;
      int now = pq.top().second;
      pq.pop();

      if(cost[now] >= 0) continue;

      cost[now] = -now_cost;
      max_cost = max(max_cost, -now_cost);

      if(now == g) return -now_cost;

      for(int i=0; i<(int)G[now].size(); i++)
        pq.push({now_cost - G[now][i].second, G[now][i].first});
    }

    return max_cost;
  }
};

int N, M, K;
ll J[SIZE], P[SIZE], c[SIZE];
vector<pair<int,int>> G[SIZE];

int main(){

  scanf("%d%d%d", &N, &M, &K);

  for (int i=0; i<N; i++) scanf("%lld", P+i);
  for (int i=0; i<N; i++) scanf("%lld", c+i);
  for (int i=0; i<N; i++) scanf("%lld", J+i);

  Dijkstra<ll> dijk(N);

  for (int i=0; i<M; i++) {
    int u, v, t;
    scanf("%d%d%d", &u, &v, &t);
    u--; v--;
    G[u].push_back({v, t});
    G[v].push_back({u, t});
    dijk.add_edge(u, v, t);
    dijk.add_edge(v, u, t);
  }

  dijk.solve(0);

  priority_queue<pair<ll,int>> pq;

  for (int i=0; i<N; i++) {
    J[i] -= dijk.cost[i];
    P[i] -= dijk.cost[i];
    pq.push({P[i], i});
  }

  bool visited[SIZE] = {};
  ll T[SIZE];
  while(pq.size()) {
    auto p = pq.top();
    pq.pop();

    int now = p.second;
    ll cost = p.first;

    if (visited[now]) continue;
    visited[now] = true;

    T[now] = cost;

    for (auto q : G[now]) {
      if (!visited[q.first]) {
        pq.push({cost - q.second, q.first});
      }
    }
  }

  ll ans[SIZE];

  for (int i=0; i<K; i++)
    ans[i] = -LLINF;

  for (int i=0; i<N; i++) {
    ans[c[i]-1] = max(ans[c[i]-1], J[i] + T[i]);
  }

  for (int i=0; i<K; i++) {
    printf("%lld\n", ans[i]);
  }

  return 0;
}

