#include <bits/stdc++.h>
using namespace std;
const int N = 1000010;
const int INF = 1000000009;
struct edge {
  int to;
  long long val;
  edge() {}
  edge(int t, long long value) : to(t), val(value) {}
  bool operator<(const edge &ed) const {
    if (val == ed.val) {
      return to > ed.to;
    }
    return val > ed.val;
  }
};
priority_queue<edge> q;
vector<pair<long long, long long> > vt[N];
int n, m, k, ans;
int dis[N];
void init() {
  for (int i = 0; i < N; i++) vt[i].clear();
}
void djstra() {
  int i, j, a;
  long long b;
  for (i = 0; i < n; i++) dis[i] = INF;
  for (i = 1; i <= k; i++) {
    scanf("%d%I64d", &a, &b);
    a--;
    q.push(edge(-a, b));
  }
  dis[0] = 0;
  long long too, dist;
  q.push(edge(0, 0));
  while (!q.empty()) {
    bool train = false;
    too = q.top().to;
    dist = q.top().val;
    q.pop();
    if (too < 0) {
      train = true;
      too = -too;
    }
    if (train) {
      if (dis[too] <= dist) {
        ans++;
        continue;
      } else
        dis[too] = dist;
    }
    if (dis[too] < dist) continue;
    for (i = 0; i < vt[too].size(); i++) {
      if (dis[vt[too][i].first] > dist + vt[too][i].second) {
        dis[vt[too][i].first] = dist + vt[too][i].second;
        q.push(edge(vt[too][i].first, dis[vt[too][i].first]));
      }
    }
  }
}
int main() {
  int i, j, a, b;
  long long c;
  while (scanf("%d%d%d", &n, &m, &k) != EOF) {
    init();
    for (i = 1; i <= m; i++) {
      scanf("%d%d%I64d", &a, &b, &c);
      a--;
      b--;
      vt[a].push_back(pair<long long, long long>(b, c));
      vt[b].push_back(pair<long long, long long>(a, c));
    }
    ans = 0;
    djstra();
    printf("%d\n", ans);
  }
}
