#include <bits/stdc++.h>
using namespace std;
struct data {
  int to, len, way;
  data(int _to, int _len, int _way) {
    to = _to;
    len = _len;
    way = _way;
  }
  friend bool operator<(const data &a, const data &b) {
    if (a.len != b.len) return a.len > b.len;
    return a.way > b.way;
  }
};
int n, m, k, ans;
bool mark[100002];
bool used[100002];
vector<data> adj[100002];
priority_queue<data> heap;
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1, x, y, z; i <= m; i++) {
    scanf("%d%d%d", &x, &y, &z);
    adj[x].push_back(data(y, z, i));
    adj[y].push_back(data(x, z, i));
  }
  for (int i = m + 1, x, y; i <= m + k; i++) {
    scanf("%d%d", &x, &y);
    adj[1].push_back(data(x, y, i));
    adj[x].push_back(data(1, y, i));
  }
  heap.push(data(1, 0, 0));
  while (!heap.empty()) {
    data tmp = heap.top();
    heap.pop();
    if (mark[tmp.to]) continue;
    mark[tmp.to] = true;
    if (tmp.way > m) used[tmp.way - m] = true;
    int sz = adj[tmp.to].size();
    for (int i = 0; i < sz; i++)
      if (!mark[adj[tmp.to][i].to])
        heap.push(data(adj[tmp.to][i].to, tmp.len + adj[tmp.to][i].len,
                       adj[tmp.to][i].way));
  }
  for (int i = 1; i <= k; i++)
    if (!used[i]) ans++;
  printf("%d\n", ans);
  return 0;
}
