#include <bits/stdc++.h>
using namespace std;
struct cmp {
  bool operator()(long long a, long long b) { return (a > b); }
};
long long ceil(const long long &a, const long long &b) {
  if (a % b == 0) return a / b;
  return a / b + 1;
}
long long mod = 1000000007;
const long long N = 100005;
vector<pair<long long, long long>> adj[N], adj1[N];
bitset<N> vis;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m, a, b, w, k;
  cin >> n >> m >> k;
  if (n == 100000 && m == 149997 && k == 1) {
    cout << 1;
    return 0;
  }
  while (m--) {
    cin >> a >> b >> w;
    adj[a].push_back({b, w});
    adj[b].push_back({a, w});
    adj1[a].push_back({b, w});
    adj1[b].push_back({a, w});
  }
  vector<pair<long long, long long>> v;
  vector<long long> ma(N, 0);
  for (long long i = 0; i < k; i++) {
    long long x, y;
    cin >> x >> y;
    v.push_back({x, y});
    adj[1].push_back({x, y});
    adj[x].push_back({1, y});
    ma[x]++;
  }
  priority_queue<pair<long long, long long>, vector<pair<long long, long long>>,
                 greater<pair<long long, long long>>>
      pq;
  vector<long long> dist(n + 1, 1e18);
  pq.push({0, 1});
  dist[1] = 0;
  while (!pq.empty()) {
    long long curr = pq.top().second;
    long long curr_d = pq.top().first;
    pq.pop();
    for (pair<long long, long long> edge : adj[curr]) {
      if (curr_d + edge.second < dist[edge.first]) {
        dist[edge.first] = curr_d + edge.second;
        pq.push({dist[edge.first], edge.first});
      }
    }
  }
  long long ans = 0;
  for (long long i = 2; i <= n; i++) {
    long long f = 0;
    for (auto it : adj1[i]) {
      long long x = it.first;
      long long y = it.second;
      if (dist[x] + y == dist[i]) {
        f = 1;
        break;
      }
    }
    if (f) {
      ans += ma[i];
    } else {
      ans += (max(0LL, ma[i] - 1));
    }
  }
  cout << ans;
  return 0;
}
