#include <bits/stdc++.h>
using namespace std;
int n, m, k;
struct edge {
  bool ss;
  long long len;
  int dest;
  edge(bool ss, long long len, int dest) : ss(ss), len(len), dest(dest) {}
};
vector<edge> G[300000];
long long dist[300000];
set<pair<long long, int> > q;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    int u, v, x;
    cin >> u >> v >> x;
    G[u - 1].push_back(edge(false, x, v - 1));
    G[v - 1].push_back(edge(false, x, u - 1));
  }
  for (int i = 0; i < k; i++) {
    int s, y;
    cin >> s >> y;
    G[0].push_back(edge(true, y, s - 1));
    G[s - 1].push_back(edge(true, y, 0));
  }
  fill(dist, dist + n + 1, 1e+16);
  dist[0] = 0;
  q.insert(make_pair(0, 0));
  while (!q.empty()) {
    int v = q.begin()->second;
    q.erase(make_pair(dist[v], v));
    for (int i = 0; i < G[v].size(); i++) {
      int u = G[v][i].dest;
      if (dist[u] > dist[v] + G[v][i].len) {
        q.erase(make_pair(dist[u], u));
        dist[u] = dist[v] + G[v][i].len;
        q.insert(make_pair(dist[u], u));
      }
    }
  }
  int ans = 0;
  for (int i = 1; i < n; i++) {
    int v = i, c = 0, cn = 0;
    for (int j = 0; j < G[i].size(); j++) {
      int u = G[v][j].dest;
      long long d = G[v][j].len;
      if (d + dist[u] == dist[v]) c++;
      if (d + dist[u] == dist[v] && G[v][j].ss) cn++;
      if (d + dist[u] > dist[v] && G[v][j].ss) ans++;
    }
    if (c > 1) {
      ans += cn - (c == cn);
    }
  }
  cout << ans;
}
