#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, M = 4e5 + 5;
const long long inf = 1e16;
int n, m, k;
struct node;
struct edge {
  node *ed;
  edge *next;
  int w;
} E[M << 1], *newE = E;
struct node {
  edge *son;
  long long dist;
  bool inq;
} V[N];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < m; i++) {
    int u, v, x;
    scanf("%d%d%d", &u, &v, &x);
    *newE = (edge){V + v, V[u].son, x}, V[u].son = newE++;
    *newE = (edge){V + u, V[v].son, x}, V[v].son = newE++;
  }
  for (int i = 0; i < k; i++) {
    int v, x;
    scanf("%d%d", &v, &x);
    *newE = (edge){V + v, V[1].son, x}, V[1].son = newE++;
    *newE = (edge){V + 1, V[v].son, x}, V[v].son = newE++;
  }
  deque<node *> q;
  q.push_back(V + 1);
  V[1].inq = true;
  V[1].dist = 0;
  for (int i = 2; i <= n; i++) V[i].dist = inf;
  while (!q.empty()) {
    node *u = q.front();
    q.pop_front();
    for (edge *e = u->son; e; e = e->next) {
      node *v = e->ed;
      if (v->dist > u->dist + e->w) {
        v->dist = u->dist + e->w;
        if (!v->inq) {
          if (!q.empty() && v->dist <= q.front()->dist)
            q.push_front(v);
          else
            q.push_back(v);
          v->inq = true;
        }
      }
    }
    u->inq = false;
  }
  int ans = 0;
  for (int i = 2; i <= n; i++) {
    int cnt = 0;
    long long dist = inf;
    for (edge *e = V[i].son; e; e = e->next)
      if (e >= E + m * 2) {
        if (e->w > V[i].dist)
          ans++;
        else
          cnt++;
      } else {
        dist = min(dist, e->ed->dist + e->w);
      }
    if (dist == V[i].dist)
      ans += cnt;
    else
      ans += cnt - 1;
  }
  printf("%d\n", ans);
}
