#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
inline long long input() {
  long long n;
  cin >> n;
  return n;
}
long long poww(long long a, long long b, long long md) {
  return (!b ? 1
             : (b & 1 ? a * poww(a * a % md, b / 2, md) % md
                      : poww(a * a % md, b / 2, md) % md));
}
const int MAXN = 1e5 + 10;
const int MOD = 1e9 + 7;
const int MOD2 = 998244353;
const long long INF = 8e18;
long long n, m, k;
bool mark[MAXN];
long long dis[MAXN];
long long dp[MAXN];
vector<long long> adj[MAXN];
vector<long long> w[MAXN];
set<pair<long long, long long> > q;
vector<pair<long long, long long> > edge;
void dij(long long s) {
  dis[s] = 0;
  for (long long i = 1; i <= n; i++) {
    if (i != s) dis[i] = INF;
    q.insert(make_pair(dis[i], i));
  }
  while (!q.empty()) {
    auto it = q.begin();
    long long u = it->second;
    mark[u] = true;
    q.erase(it);
    for (long long i = 0; i < adj[u].size(); i++) {
      long long v = adj[u][i];
      if (dis[u] + w[u][i] == dis[v]) {
        dp[v]++;
      }
      if (mark[v]) continue;
      long long cnt;
      cnt = min(dis[v], dis[u] + w[u][i]);
      if (cnt < dis[v]) dp[v] = 1;
      if (cnt == w[u][i] + dis[u]) {
        q.erase(make_pair(dis[v], v));
        dis[v] = cnt;
        q.insert(make_pair(dis[v], v));
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m >> k;
  long long a, b, wei;
  for (int i = 0; i < m; i++) {
    cin >> a >> b >> wei;
    adj[a].push_back(b);
    adj[b].push_back(a);
    w[a].push_back(wei);
    w[b].push_back(wei);
  }
  long long ans = 0;
  for (int i = 0; i < k; i++) {
    cin >> a >> wei;
    edge.push_back({wei, a});
    adj[1].push_back(a);
    adj[a].push_back(1);
    w[1].push_back(wei);
    w[a].push_back(wei);
  }
  dij(1);
  for (int i = 0; i < k; i++) {
    a = edge[i].second;
    wei = edge[i].first;
    if (dis[a] < wei) {
      ans++;
    } else {
      if (dp[a] > 1) {
        ans++;
        dp[a]--;
      }
    }
  }
  cout << ans << "\n";
}
