#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 30;
const long long maxn = 1e6 + 10;
int head[maxn], ecnt;
struct Edge {
  int u, v, w, next;
} es[maxn];
void addEdge(int u, int v, int w) {
  es[ecnt].u = u, es[ecnt].v = v, es[ecnt].w = w;
  es[ecnt].next = head[u], head[u] = ecnt++;
}
int N, M, K;
int d[maxn];
bool used[maxn];
int in[maxn];
void dijkstra(int s) {
  memset(used, 0, sizeof(used));
  ;
  fill(d, d + maxn, inf);
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      q;
  q.push(pair<int, int>(d[s] = 0, s));
  while (!q.empty()) {
    pair<int, int> cur = q.top();
    q.pop();
    int u = cur.second;
    if (used[u]) continue;
    used[u] = true;
    for (int i = head[u]; i != -1; i = es[i].next) {
      int v = es[i].v, w = es[i].w;
      if (d[v] > d[u] + w) {
        d[v] = d[u] + w;
        q.push(pair<int, int>(d[v], v));
        in[v] = 1;
      } else if (d[v] == d[u] + w)
        ++in[v];
    }
  }
}
int s[maxn], y[maxn];
int main() {
  memset(head, -1, sizeof(head));
  ;
  ecnt = 0;
  int a, b, c;
  cin >> N >> M >> K;
  for (int i = 1; i <= M; ++i) {
    cin >> a >> b >> c;
    addEdge(a, b, c);
    addEdge(b, a, c);
  }
  for (int i = 1; i <= K; ++i) {
    cin >> s[i] >> y[i];
    addEdge(1, s[i], y[i]);
    addEdge(s[i], 1, y[i]);
  }
  dijkstra(1);
  int ans = 0;
  for (int i = 1; i <= K; ++i) {
    if (d[s[i]] < y[i])
      ++ans;
    else if (d[s[i]] == y[i] && in[s[i]] > 1)
      --in[s[i]], ++ans;
  }
  cout << ans << endl;
  return 0;
}
