#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e15;
const int maxn = 100003;
int n, m, k;
vector<pair<pair<long long, long long>, int> > v[maxn];
vector<pair<long long, long long> > ve;
long long dist[maxn];
bool used[maxn];
int tot[maxn];
void dij() {
  for (int i = 0; i < maxn; i++) {
    dist[i] = inf;
  }
  priority_queue<pair<pair<long long, long long>, int> > pq;
  pq.push(pair<pair<long long, long long>, int>(
      pair<long long, long long>(0, 0), 0));
  while (pq.size()) {
    int cur = pq.top().second;
    int d = -pq.top().first.first;
    bool b = pq.top().first.second;
    pq.pop();
    if (dist[cur] != inf) continue;
    dist[cur] = d;
    used[cur] = b;
    for (int i = 0; i < v[cur].size(); i++) {
      int nxt = v[cur][i].first.first;
      long long nd = d + v[cur][i].first.second;
      bool nb = v[cur][i].second;
      if (nd < dist[nxt]) {
        pq.push(pair<pair<long long, long long>, int>(
            pair<long long, long long>(-nd, nb), nxt));
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    int a, b, d;
    cin >> a >> b >> d;
    a--;
    b--;
    v[a].push_back(pair<pair<long long, long long>, int>(
        pair<long long, long long>(b, d), 1));
    v[b].push_back(pair<pair<long long, long long>, int>(
        pair<long long, long long>(a, d), 1));
  }
  for (int i = 0; i < k; i++) {
    int a, d;
    cin >> a >> d;
    a--;
    v[a].push_back(pair<pair<long long, long long>, int>(
        pair<long long, long long>(0, d), 0));
    v[0].push_back(pair<pair<long long, long long>, int>(
        pair<long long, long long>(a, d), 0));
    ve.push_back(pair<long long, long long>(a, d));
  }
  dij();
  int ans = 0;
  for (int i = 0; i < k; i++) {
    int a = ve[i].first, d = ve[i].second;
    if (d > dist[a])
      ans++;
    else {
      if (used[a])
        ans++;
      else
        tot[a]++;
    }
  }
  for (int i = 0; i < n; i++) {
    if (tot[i]) {
      ans += tot[i] - 1;
    }
  }
  cout << ans;
}
