#include <bits/stdc++.h>
using namespace std;
template <class t>
t mag(t a) {
  return a > 0 ? a : -a;
}
template <class T>
T cdiv(T num, T den) {
  return (num / den) + (num % den > 0);
}
std::ifstream term("/dev/tty");
std::string tempstring;
using ll = int_fast64_t;
using ii = pair<ll, int>;
using vi = vector<int>;
using vl = vector<ll>;
const int sij = 1000010;
const ll mod = 1000000007ll;
int tc = 1;
int n, m, k, in[sij];
ll d[sij];
vector<ii> adj[sij];
vector<ii> one;
bool mark[sij];
int escape(int tcase) {
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    int u, v, x;
    cin >> u >> v >> x;
    adj[u].push_back({v, x});
    adj[v].push_back({u, x});
  }
  for (int i = 0; i < k; i++) {
    int s, y;
    cin >> s >> y;
    adj[1].push_back({s, y});
    one.push_back({s, y});
  }
  std::priority_queue<ii, vector<ii>, greater<ii>> pq;
  for (int i = 2; i <= n; i++) d[i] = mod;
  pq.push({0, 1});
  while (!pq.empty()) {
    ii kk = pq.top();
    pq.pop();
    int src = kk.second, dist = kk.first;
    if (mark[src]) continue;
    mark[src] = 1;
    for (auto &e : adj[src]) {
      if (d[e.first] > dist + e.second) {
        d[e.first] = dist + e.second;
        pq.push({d[e.first], e.first});
      }
    }
  }
  vector<ii> checkagain;
  for (int i = 1; i <= n; i++) {
    (i, d[i]);
    for (auto &e : adj[i]) {
      if (d[e.first] == d[i] + e.second) {
        in[e.first]++;
      }
    }
    if (i == 1) {
      for (auto &e : one) {
        if (d[e.first] == e.second) {
          checkagain.push_back({e.first, e.second});
        }
      }
    }
  }
  int prt = k - checkagain.size();
  for (auto &e : checkagain) {
    if (in[e.first] > 1) {
      prt++;
      in[e.first]--;
    }
  }
  cout << prt;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (int i = 1; i <= tc; i++) escape(i);
}
