#include <bits/stdc++.h>
using namespace std;
template <class T>
void dbs(string str, T t) {
  cerr << str << " : " << t << "\n";
}
template <class T, class... S>
void dbs(string str, T t, S... s) {
  long long idx = str.find(',');
  cerr << str.substr(0, idx) << " : " << t << ", ";
  dbs(str.substr(idx + 1), s...);
}
template <class T>
void prc(T a, T b) {
  cerr << "[";
  for (T i = a; i != b; ++i) {
    if (i != a) cerr << ", ";
    cerr << *i;
  }
  cerr << "]\n";
}
template <class T>
void prall(T a) {
  prc(a.begin(), a.end());
}
const int inf = 1000 * 1000 * 1000 + 9;
const long long infl = 1ll * inf * inf;
const int mod = 1000 * 1000 * 1000 + 7;
struct E {
  int to, w, train;
};
struct S {
  long long u, v, d, train;
  bool operator<(const S& s) const {
    if (s.d < d)
      return 1;
    else if (s.d == d) {
      return s.train < train;
    }
    return 0;
  }
};
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<vector<E>> adj(n + 1);
  map<pair<int, int>, int> edges;
  int ans = 0;
  for (int i = 0; i < m; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    if (u > v) swap(u, v);
    if (edges.find(make_pair(u, v)) == edges.end())
      edges[make_pair(u, v)] = w;
    else
      edges[make_pair(u, v)] = min(w, edges[make_pair(u, v)]);
  }
  for (auto p : edges) {
    int u = p.first.first, v = p.first.second, w = p.second;
    adj[u].push_back({v, w, 0});
    adj[v].push_back({u, w, 0});
  }
  edges.clear();
  for (int i = 0; i < k; i++) {
    int u, w;
    cin >> u >> w;
    int v = 1;
    swap(u, v);
    if (edges.find(make_pair(u, v)) == edges.end())
      edges[make_pair(u, v)] = w;
    else {
      ans++;
      edges[make_pair(u, v)] = min(w, edges[make_pair(u, v)]);
    }
  }
  for (auto p : edges) {
    int u = p.first.first, v = p.first.second, w = p.second;
    adj[u].push_back({v, w, 1});
    adj[v].push_back({u, w, 1});
  }
  priority_queue<S> q;
  vector<long long> dist(n + 1, infl);
  q.push({0, 1, 0, 0});
  int used = 0;
  while (!q.empty()) {
    auto p = q.top();
    q.pop();
    if (p.d < dist[p.v]) {
      dist[p.v] = p.d;
      if (p.train) used++;
      for (auto& e : adj[p.v]) {
        q.push({p.v, e.to, p.d + e.w, e.train});
      }
    }
  }
  cout << k - used << '\n';
}
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout << fixed << setprecision(13);
  solve();
}
