#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int a[100005], jii = 0, ans[100005];
struct node {
  int from, to, dis;
} lu[600005];
struct Te {
  int x, zhi;
} te[100005];
void build(int from, int to, int dis) {
  jii++;
  lu[jii].from = a[from];
  lu[jii].to = to;
  lu[jii].dis = dis;
  a[from] = jii;
}
struct dui {
  int dian;
} dian;
priority_queue<dui> q;
bool operator<(dui a, dui b) { return ans[a.dian] > ans[b.dian]; }
bool cha[100005];
void spfa() {
  for (int i = 1; i <= n; i++) {
    ans[i] = 1000000009;
  }
  ans[1] = 0;
  dian.dian = 1;
  q.push(dian);
  while (q.empty() == 0) {
    int u = q.top().dian;
    q.pop();
    cha[u] = 0;
    for (int i = a[u]; i; i = lu[i].from) {
      int x = lu[i].to;
      if (ans[x] > ans[u] + lu[i].dis) {
        ans[x] = ans[u] + lu[i].dis;
        if (cha[x] == 0) {
          dian.dian = x;
          q.push(dian);
          cha[x] = 1;
        }
      }
    }
  }
}
bool qwe(Te a, Te b) { return a.zhi < b.zhi; }
void gai(int k) {
  dian.dian = k;
  q.push(dian);
  while (q.empty() == 0) {
    int u = q.top().dian;
    cha[u] = 0;
    q.pop();
    for (int i = a[u]; i; i = lu[i].from) {
      int x = lu[i].to;
      if (ans[x] > ans[u] + lu[i].dis) {
        ans[x] = ans[u] + lu[i].dis;
        if (cha[x] == 0) {
          cha[x] = 1;
          dian.dian = x;
          q.push(dian);
        }
      }
    }
  }
}
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    int x, y, z;
    scanf("%d%d%d", &x, &y, &z);
    build(x, y, z);
    build(y, x, z);
  }
  spfa();
  for (int i = 0; i < k; i++) {
    scanf("%d%d", &te[i].x, &te[i].zhi);
  }
  sort(te, te + k, qwe);
  int jians = 0;
  for (int i = 0; i < k; i++) {
    if (ans[te[i].x] > te[i].zhi) {
      ans[te[i].x] = te[i].zhi;
      gai(te[i].x);
    } else
      jians++;
  }
  cout << jians;
}
