#include <bits/stdc++.h>
using namespace std;
struct Pair {
  int D, V;
  Pair(long long d, int v) { D = d, V = v; }
  friend bool operator<(const Pair a, const Pair b) { return a.D > b.D; }
};
struct typ {
  int to, fl, nxt;
  long long w;
} edge[800005];
int tot, n, m, k, ans;
int used[100005], head[100005], rout[100005], in[100005], dest[100005];
long long dis[100005];
void dijk() {
  memset(used, 0, sizeof used);
  priority_queue<Pair> que;
  dis[1] = 0;
  que.push(Pair(0, 1));
  while (!que.empty()) {
    Pair now = que.top();
    que.pop();
    if (used[now.V]) continue;
    used[now.V] = 1;
    for (int i = head[now.V]; i != -1; i = edge[i].nxt) {
      int to = edge[i].to;
      if (dis[to] == dis[now.V] + edge[i].w) {
        in[to]++;
      }
      if (dis[to] > dis[now.V] + edge[i].w) {
        in[to] = 1;
        dis[to] = dis[now.V] + edge[i].w;
        que.push(Pair(dis[to], to));
      }
    }
  }
}
void addedge(int u, int v, long long c) {
  edge[tot].to = v;
  edge[tot].w = c;
  edge[tot].nxt = head[u];
  head[u] = tot;
  tot++;
}
long long Min(long long a, long long b) {
  if (a > b) return b;
  return a;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m >> k;
  tot = 0;
  memset(head, -1, sizeof head);
  memset(in, 0, sizeof in);
  int x, y;
  long long z;
  for (int i = 1; i <= m; i++) {
    cin >> x >> y >> z;
    addedge(x, y, z);
    addedge(y, x, z);
  }
  for (int i = 0; i <= n; i++) dis[i] = 1e15;
  ans = 0;
  for (int i = 1; i <= k; i++) {
    cin >> x >> z;
    addedge(1, x, z);
    dest[i] = x;
    rout[i] = z;
  }
  dijk();
  int ans = 0;
  for (int i = 1; i <= k; i++) {
    int u = dest[i];
    if (dis[u] == rout[i] && in[u] > 1) {
      ans++;
      in[u]--;
    } else if (dis[u] < rout[i]) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
