#include <bits/stdc++.h>
using namespace std;
struct kraw {
  int v;
  long long w;
  bool isTrain;
  bool operator<(const kraw &b) const { return w > b.w; }
} tmp, act;
priority_queue<kraw> Q;
vector<kraw> V[100010];
long long d[100010];
int from, to, dist, n, m, k, res = 0;
void dijkstra(int v) {
  for (int i = 1; i <= n; ++i) d[i] = 100000001000000001;
  tmp.v = v;
  tmp.w = d[v] = 0;
  for (Q.push(tmp); !Q.empty();) {
    act = Q.top();
    Q.pop();
    if (act.isTrain) {
      if (act.w >= d[act.v]) {
        res++;
        continue;
      } else {
        d[act.v] = act.w;
      }
    }
    if (d[act.v] < act.w) continue;
    for (vector<kraw>::iterator i = V[act.v].begin(); i != V[act.v].end();
         i++) {
      if (d[i->v] > d[act.v] + i->w) {
        tmp.v = i->v;
        tmp.w = d[tmp.v] = d[act.v] + i->w;
        Q.push(tmp);
      }
    }
  }
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i < m; ++i) {
    scanf("%d %d %d", &from, &to, &dist);
    act.v = to;
    act.w = dist;
    act.isTrain = false;
    V[from].push_back(act);
    act.v = from;
    V[to].push_back(act);
  }
  for (int i = 0; i < k; ++i) {
    scanf("%d %d", &to, &dist);
    act.v = to;
    act.w = dist;
    act.isTrain = true;
    Q.push(act);
  }
  dijkstra(1);
  printf("%d", res);
  return 0;
}
