#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<int, int> > adj[100005];
pair<int, int> route[100005];
int cnt[100005];
int64_t d[100005];
int cl[100005];
set<pair<int64_t, int> > q;
void Dijkstra() {
  d[1] = 0;
  cl[1] = 1;
  q.insert({0, 1});
  while (!q.empty()) {
    int u = q.begin()->second;
    q.erase(q.begin());
    for (auto &e : adj[u]) {
      int v = e.first, L = e.second;
      if (cl[v] == 0) {
        cl[v] = 1;
        d[v] = d[u] + L;
        cnt[v] = 1;
        q.insert({d[v], v});
      } else {
        if (d[v] > d[u] + L) {
          q.erase({d[v], v});
          d[v] = d[u] + L;
          cnt[v] = 1;
          q.insert({d[v], v});
        } else if (d[v] == d[u] + L)
          ++cnt[v];
      }
    }
  }
}
int main() {
  int m, k;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= m; ++i) {
    int u, v, w;
    scanf("%d %d %d", &u, &v, &w);
    adj[u].push_back({v, w});
    adj[v].push_back({u, w});
  }
  for (int i = 1; i <= k; ++i) {
    int v, w;
    scanf("%d %d", &v, &w);
    route[i] = {w, v};
    adj[1].push_back({v, w});
    adj[v].push_back({1, w});
  }
  Dijkstra();
  int res = 0;
  for (int i = 1; i <= k; ++i) {
    int v = route[i].second, L = route[i].first;
    if (L > d[v])
      ++res;
    else if (cnt[v] > 1)
      ++res, --cnt[v];
  }
  printf("%d", res);
}
