#include <bits/stdc++.h>
using namespace std;
long long arr[100009] = {0};
long long dp[100009];
vector<pair<long long, long long> > graph[100009];
void dij() {
  priority_queue<pair<long long, long long>,
                 std::vector<pair<long long, long long> >,
                 std::greater<pair<long long, long long> > >
      qee;
  qee.push(make_pair(0, 1));
  while (qee.size()) {
    pair<long long, long long> temp;
    temp = qee.top();
    qee.pop();
    if (dp[temp.second] <= temp.first) continue;
    dp[temp.second] = temp.first;
    for (int f = 0; f < graph[temp.second].size(); f++)
      qee.push(make_pair(
          graph[temp.second][f].second + min(arr[temp.second], temp.first),
          graph[temp.second][f].first));
  }
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int f = 0; f < m; f++) {
    long long a, b, c;
    cin >> a >> b >> c;
    graph[a].push_back(make_pair(b, c));
    graph[b].push_back(make_pair(a, c));
  }
  for (int f = 0; f < 100009; f++) {
    dp[f] = arr[f] = 1e18;
  }
  long long ans = 0;
  for (int f = 0; f < k; f++) {
    long long a, b;
    cin >> a >> b;
    if (arr[a] != 1e18) ans++;
    arr[a] = min(arr[a], b);
  }
  dij();
  for (int f = 0; f < 100009; f++) {
    if (arr[f] != 1e18 && arr[f] >= dp[f]) ans++;
  }
  cout << ans;
}
