#include <bits/stdc++.h>
const long long INF = 1LL << 62;
long long dis[101000];
int head[101000], flag[101000];
int queue[401000 * 2];
int EN, ans;
int n, m, k, u, v, st, ed;
;
long long c;
bool vis[101000];
struct Edge {
  int v, next;
  long long c;
} edge[401000 * 2];
void addedge(int u, int v, long long c) {
  edge[EN].v = v;
  edge[EN].c = c;
  edge[EN].next = head[u];
  head[u] = EN++;
}
void spfa(int s) {
  int i, x;
  while (st < ed) {
    x = queue[st++];
    st %= 401000 * 2;
    vis[x] = false;
    for (i = head[x]; ~i; i = edge[i].next) {
      int v = edge[i].v;
      if (dis[v] >= dis[x] + edge[i].c) {
        if (flag[v]) {
          flag[v] = 0, ans++;
        }
        dis[v] = dis[x] + edge[i].c;
        if (!vis[v]) vis[v] = true, queue[ed++] = v, ed %= 401000 * 2;
      }
    }
  }
}
int main() {
  ans = EN = 0;
  scanf("%d%d%d", &n, &m, &k);
  memset(head, -1, sizeof(head));
  for (int i = 0; i <= n; i++) dis[i] = INF;
  while (m--) {
    scanf("%d%d%I64d", &u, &v, &c);
    addedge(u, v, c);
    addedge(v, u, c);
  }
  st = ed = 0;
  memset(vis, false, sizeof(vis));
  queue[ed++] = 1;
  dis[1] = 0;
  while (k--) {
    scanf("%d%I64d", &v, &c);
    flag[v] = 1;
    if (dis[v] == INF) {
      queue[ed++] = v;
      dis[v] = c;
      vis[v] = 1;
    } else {
      ans++;
      if (dis[v] > c) dis[v] = c;
    }
  }
  spfa(1);
  printf("%d\n", ans);
  return 0;
}
