#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn = 1e5 + 10;
int n, m, k, s[maxn];
bool relaxed[maxn];
ll dp[maxn], y[maxn], cnt[maxn];
vector<pair<int, ll>> adj[maxn];
set<pair<int, ll>> ms;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  memset(dp, 63, sizeof dp);
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    adj[--u].push_back({--v, w});
    adj[v].push_back({u, w});
  }
  for (int i = 0; i < k; i++) {
    cin >> s[i] >> y[i];
    adj[--s[i]].push_back({0, y[i]});
    adj[0].push_back({s[i], y[i]});
  }
  dp[0] = 0;
  ms.insert({0, 0});
  while (ms.size()) {
    int v = (*ms.begin()).second;
    ms.erase(ms.begin());
    if (relaxed[v]) continue;
    relaxed[v] = 1;
    for (auto tmp : adj[v]) {
      int u = tmp.first;
      int w = tmp.second;
      if (dp[u] > dp[v] + w) {
        if (dp[u] < dp[maxn - 1]) ms.erase({dp[u], u});
        dp[u] = dp[v] + w;
        cnt[u] = 1;
        ms.insert({dp[u], u});
      } else if (dp[u] == dp[v] + w)
        cnt[u]++;
    }
  }
  int ans = 0;
  for (int i = 0; i < k; i++)
    if (dp[s[i]] < y[i])
      ans++;
    else if (dp[s[i]] == y[i] && cnt[s[i]] >= 2) {
      cnt[s[i]]--;
      ans++;
    }
  cout << ans << "\n";
  return 0;
}
