#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
struct Edge {
  int from, to, next;
  long long val;
  int flag;
} ee[maxn * 8];
int inq[maxn], cnt, head[maxn];
long long dist[maxn];
void addedge(int from, int to, int val, int flag) {
  ee[cnt].from = from;
  ee[cnt].to = to;
  ee[cnt].val = val;
  ee[cnt].next = head[from];
  ee[cnt].flag = flag;
  head[from] = cnt++;
}
int n, m, k;
int ee_code[maxn * 8], ee_num, in_deg[maxn];
void SPFA() {
  for (int i = 1; i <= n; i++) dist[i] = 10000000000000LL;
  deque<int> q;
  memset(inq, 0, sizeof(inq));
  q.push_back(1);
  inq[1] = 1;
  dist[1] = 0;
  while (!q.empty()) {
    int cur = q.front();
    q.pop_front();
    inq[cur] = 0;
    for (int i = head[cur]; i != -1; i = ee[i].next) {
      int to = ee[i].to;
      if (dist[cur] + ee[i].val < dist[to]) {
        dist[to] = dist[cur] + ee[i].val;
        if (!inq[to]) {
          if (!q.empty() && dist[to] < dist[q.front()])
            q.push_front(to);
          else
            q.push_back(to);
          inq[to] = 1;
        }
      }
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  cnt = 0;
  int u, v, t;
  memset(head, -1, sizeof(head));
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &u, &v, &t);
    addedge(u, v, t, 0);
    addedge(v, u, t, 0);
  }
  for (int i = 0; i < k; i++) {
    scanf("%d%d", &v, &t);
    addedge(1, v, t, 1);
  }
  SPFA();
  ee_num = 0;
  for (int i = 0; i < cnt; i++) {
    if (dist[ee[i].from] + ee[i].val == dist[ee[i].to]) {
      ee_code[ee_num++] = i;
    }
  }
  int ans = 0, temp = 0;
  memset(in_deg, 0, sizeof(in_deg));
  for (int i = 0; i < ee_num; i++) {
    in_deg[ee[ee_code[i]].to]++;
    if (ee[ee_code[i]].flag) {
      ans++;
      if (in_deg[ee[ee_code[i]].to] > 1) temp++;
    }
  }
  ans = (k - ans);
  ans += temp;
  cout << ans << endl;
  return 0;
}
