#include <bits/stdc++.h>
using namespace std;
priority_queue<pair<long long, int>> pq;
vector<vector<pair<long long, long long>>> vec;
map<pair<int, int>, int> mop;
vector<long long> vis(100001, 0);
long long check() {
  int c = 0;
  pq.push(make_pair(0, 1));
  while (pq.size()) {
    int node = pq.top().second;
    long long dis = -1 * pq.top().first;
    pq.pop();
    if (vis[abs(node)]) continue;
    if (node < 0) c++, node *= -1;
    vis[node] = 1;
    for (int i = 0; i < vec[node].size(); i++) {
      if (vis[vec[node][i].first] == 0) {
        pq.push({-1 * (dis + vec[node][i].second), vec[node][i].first});
      }
    }
  }
  return c;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ;
  int n, m, k;
  cin >> n >> m >> k;
  int a, b, c;
  vec.resize(n + 1);
  for (int i = 0; i < m; i++) {
    cin >> a >> b >> c;
    vec[a].push_back({b, c});
    vec[b].push_back({a, c});
  }
  long long ans = 0;
  for (int i = 0; i < k; i++) {
    cin >> a >> b;
    pq.push({-b, -a});
  }
  cout << k - check() << endl;
}
