#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200000 + 10;
const int MAXM = 800000 + 10;
struct Edge {
  int u;
  int to;
  int next;
  bool t;
  long long cal;
  Edge(int _from = 0, int _to = 0, long long _cal = 0, bool _t = false,
       int _next = 0)
      : u(_from), to(_to), cal(_cal), t(_t), next(_next) {}
} edge[MAXM];
int head[MAXN], tot;
long long dis[MAXN];
bool vis[MAXN], vis1[MAXN];
bool istrain[MAXN];
int path[MAXN];
void addedge(int u, int v, long long cal, bool t) {
  edge[tot].to = v;
  edge[tot].cal = cal;
  edge[tot].t = t;
  edge[tot].next = head[u];
  head[u] = tot++;
}
void init() {
  memset(head, -1, sizeof head);
  memset(istrain, false, sizeof istrain);
  tot = 0;
}
struct cmp {
  bool operator()(const pair<int, pair<int, long long>> &x,
                  const pair<int, pair<int, long long>> &y) {
    if (x.second.second != y.second.second)
      return x.second.second > y.second.second;
    return x.first > y.first;
  }
};
int ans = 0;
void dij() {
  priority_queue<pair<int, pair<int, long long>>,
                 vector<pair<int, pair<int, long long>>>, cmp>
      pq;
  for (int i = 0; i < MAXN; i++)
    dis[i] = (long long)1000000000 * (long long)100000 + 50;
  pq.push(pair<int, pair<int, long long>>(0, pair<int, long long>(1, 0)));
  dis[1] = 0;
  while (!pq.empty()) {
    pair<int, pair<int, long long>> tmp = pq.top();
    pq.pop();
    if (vis[tmp.second.first]) continue;
    vis[tmp.second.first] = true;
    if (tmp.first) ans++;
    int u = tmp.second.first;
    for (int i = head[u]; i != -1; i = edge[i].next) {
      int v = edge[i].to;
      if (vis[v]) continue;
      long long w = edge[i].cal;
      bool train = edge[i].t;
      if ((dis[v] >= dis[u] + w)) {
        dis[v] = dis[u] + w;
        pq.push(pair<int, pair<int, long long>>(
            train, pair<int, long long>(v, dis[v])));
      }
    }
  }
}
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  init();
  memset(istrain, false, sizeof istrain);
  for (int i = 0; i < m; i++) {
    int u, v;
    long long wei;
    scanf("%d%d%I64d", &u, &v, &wei);
    addedge(u, v, wei, false);
    addedge(v, u, wei, false);
  }
  for (int i = 0; i < k; i++) {
    int u, v;
    long long wei;
    scanf("%d%I64d", &v, &wei);
    addedge(1, v, wei, true);
    addedge(v, 1, wei, true);
  }
  ans = 0;
  dij();
  printf("%d\n", k - ans);
}
