#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 20;
const long long inf = 1e10;
vector<pair<int, long long>> gr[N];
long long dis[N];
bool miad[N];
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    long long u, v, w;
    cin >> u >> v >> w;
    gr[u].push_back({v, w});
    gr[v].push_back({u, w});
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) dis[i] = inf;
  for (int i = 0; i < k; i++) {
    long long s, y;
    cin >> s >> y;
    dis[s] = min(dis[s], y);
    miad[s] = true;
  }
  set<pair<long long, int>> q;
  dis[1] = 0;
  for (int i = 1; i <= n; i++) q.insert({dis[i], i});
  while (!q.empty()) {
    int u = q.begin()->second;
    q.erase(q.begin());
    for (auto [v, w] : gr[u]) {
      if (dis[v] >= dis[u] + w && miad[v]) {
        miad[v] = false;
        q.erase({dis[v], v});
        dis[v] = dis[u] + w;
        q.insert({dis[v], v});
      } else if (dis[v] > dis[u] + w) {
        q.erase({dis[v], v});
        dis[v] = dis[u] + w;
        q.insert({dis[v], v});
        miad[v] = false;
      }
    }
  }
  for (int i = 2; i <= n; i++)
    if (miad[i]) cnt++;
  cout << k - cnt;
  return 0;
}
