#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fll;
const double Pi = acos(-1.0);
struct no {
  int id;
  long long dist;
  no(int id = 0, long long dist = 0) : id(id), dist(dist) {}
  bool operator<(const no &q) const { return dist > q.dist; }
};
vector<int> I[100100], IP[100100], E[100100], W[100100];
vector<pair<int, int> > p;
long long dist[100100], dist2[100100];
void bfs(int n) {
  for (int i = 0; i < n + 1; i++) dist[i] = LINF;
  priority_queue<no> Q;
  Q.push(no(1, 0));
  while (!Q.empty()) {
    no e = Q.top();
    Q.pop();
    if (e.dist >= dist[e.id]) continue;
    dist[e.id] = e.dist;
    for (int i = 0; i < (int)E[e.id].size(); i++) {
      if (dist[E[e.id][i]] < e.dist + (long long)abs(W[e.id][i])) continue;
      Q.push(no(E[e.id][i], e.dist + (long long)abs(W[e.id][i])));
    }
  }
}
int RESP, chega[100100];
bool flag[100100];
void dfs(int id) {
  if (flag[id]) return;
  flag[id] = true;
  for (int i = 0; i < (int)I[id].size(); i++)
    if (IP[id][i] < 0 && (int)I[id].size() > 1 && dist[id] != dist2[id]) RESP++;
  for (int i = 0; i < (int)I[id].size(); i++) dfs(I[id][i]);
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    E[a].push_back(b);
    E[b].push_back(a);
    W[a].push_back(c);
    W[b].push_back(c);
  }
  bfs(n);
  for (int i = 0; i < n + 1; i++) dist2[i] = dist[i];
  vector<pair<int, int> > q;
  for (int i = 0; i < k; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    q.push_back(make_pair(a, b));
  }
  sort(q.begin(), q.end());
  RESP = 0;
  for (int i = 0; i < k; i++) {
    if ((i == 0 || q[i].first != q[i - 1].first) &&
        dist2[q[i].first] > q[i].second)
      p.push_back(q[i]);
    else
      RESP++;
  }
  for (int i = 0; i < (int)p.size(); i++) {
    E[1].push_back(p[i].first);
    W[1].push_back(-p[i].second);
  }
  bfs(n);
  for (int i = 1; i < n + 1; i++)
    for (int j = 0; j < (int)E[i].size(); j++) {
      if (dist[i] + (long long)abs(W[i][j]) == dist[E[i][j]]) {
        I[E[i][j]].push_back(i);
        IP[E[i][j]].push_back(W[i][j]);
      } else if (W[i][j] < 0) {
        RESP++;
      }
    }
  for (int i = 1; i < n + 1; i++)
    for (int j = 0; j < (int)I[i].size(); j++) chega[I[i][j]]++;
  for (int i = 1; i < n + 1; i++) flag[i] = false;
  for (int i = 1; i < n + 1; i++)
    if (!chega[i]) {
      dfs(i);
    }
  cout << RESP << endl;
  return 0;
}
