#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
const int M = 100 + 7;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
const double PI = acos(-1);
struct node {
  int v, cost, nx, id;
} edge[N];
int n, m, k, tot, head[N], ans[N];
long long d[N];
bool op[N];
void add(int u, int v, int cost, int _op) {
  edge[tot].v = v;
  edge[tot].cost = cost;
  edge[tot].nx = head[u];
  edge[tot].id = tot;
  op[tot] = _op;
  head[u] = tot++;
}
void Djs() {
  priority_queue<pair<long long, int>, vector<pair<long long, int> >,
                 greater<pair<long long, int> > >
      Q;
  d[1] = 0;
  Q.push(make_pair(0, 1));
  while (!Q.empty()) {
    int u = Q.top().second;
    long long cost = Q.top().first;
    Q.pop();
    if (cost > d[u]) continue;
    for (int i = head[u]; ~i; i = edge[i].nx) {
      int v = edge[i].v;
      if (cost + edge[i].cost < d[v]) {
        ans[v] = edge[i].id;
        d[v] = cost + edge[i].cost;
        Q.push(make_pair(d[v], v));
      } else if (cost + edge[i].cost == d[v] &&
                 (ans[v] == -1 || !op[edge[i].id])) {
        ans[v] = edge[i].id;
      }
    }
  }
}
int main() {
  memset(head, -1, sizeof(head));
  memset(ans, -1, sizeof(ans));
  memset(d, INF, sizeof(d));
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= m; i++) {
    int u, v, cost;
    scanf("%d%d%d", &u, &v, &cost);
    add(u, v, cost, 0);
    add(v, u, cost, 0);
  }
  for (int i = 1; i <= k; i++) {
    int to, cost;
    scanf("%d%d", &to, &cost);
    add(1, to, cost, 1);
    add(to, 1, cost, 1);
  }
  Djs();
  int ret = 0;
  for (int i = 2; i <= n; i++) {
    if (op[ans[i]]) ret++;
  }
  printf("%d\n", k - ret);
  return 0;
}
