#include <bits/stdc++.h>
using namespace std;
struct EDGE {
  int u, v, l, next;
  bool train;
  EDGE() {}
  EDGE(int a, int b, int c, int d, bool bo) {
    u = a;
    v = b;
    l = c;
    next = d;
    train = bo;
  }
} edge[1000000];
int n, m, k;
int edgenumber, head[200100], visit[200100], fr[200100];
long long d[200100];
void addedge(int u, int v, int l, bool bo) {
  edge[edgenumber] = EDGE(u, v, l, head[u], bo);
  head[u] = edgenumber++;
}
void spfa(int rt) {
  memset(d, 0x3f3f3f3f, sizeof(d));
  priority_queue<pair<int, long long> > q;
  q.push(make_pair(1, 0));
  visit[rt] = 1;
  d[rt] = 0;
  while (!q.empty()) {
    int u = q.top().first;
    q.pop();
    for (int i = head[u]; i != -1; i = edge[i].next) {
      int v = edge[i].v;
      int l = edge[i].l;
      if (d[u] + l < d[v]) {
        d[v] = d[u] + l;
        fr[v] = i;
        if (!visit[v]) {
          visit[v] = 1;
          q.push(make_pair(v, -d[v]));
        }
      } else if (d[v] == d[u] + l && edge[fr[v]].train) {
        fr[v] = i;
      }
    }
    visit[u] = 0;
  }
  for (int i = 2; i <= n; i++)
    if (edge[fr[i]].train) k--;
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  edgenumber = 0;
  memset(head, -1, sizeof(head));
  vector<pair<int, int> > kn;
  for (int i = 0; i < m; i++) {
    int u, v, l;
    scanf("%d%d%d", &u, &v, &l);
    addedge(u, v, l, false);
    addedge(v, u, l, false);
  }
  for (int i = 0; i < k; i++) {
    int v, l;
    scanf("%d%d", &v, &l);
    kn.push_back(make_pair(v, l));
    addedge(1, v, l, true);
  }
  spfa(1);
  printf("%d\n", k);
  return 0;
}
