#include <bits/stdc++.h>
using namespace std;
struct edge {
  int end, s;
  bool v;
  edge(int _end, int _s, bool _v) {
    end = _end;
    s = _s;
    v = _v;
  }
  edge() {}
};
vector<edge> g[100010];
int tot, n, m, ans, i, k, x, y, c, pre[100010], fa[100010], s[100010],
    qq[100010], q[100010 * 4];
long long dis[100010];
bool vis[100010];
void spfa() {
  int u, t, w;
  memset(dis, 60, sizeof(dis));
  q[1] = 1;
  t = 0;
  w = 1;
  vis[1] = true;
  dis[1] = 0;
  while (t != w) {
    t++;
    if (t > n) t = 1;
    long long x = q[t];
    for (int i = 0; i < g[x].size(); i++) {
      u = g[x][i].end;
      if (dis[u] > dis[x] + g[x][i].s) {
        dis[u] = dis[x] + g[x][i].s;
        if (g[x][i].v)
          pre[u] = 1;
        else
          pre[u] = 2;
        if (!vis[u]) {
          w++;
          if (w > n) w = 1;
          q[w] = u;
          vis[u] = true;
        }
      } else if ((dis[u] == dis[x] + g[x][i].s) && (pre[u] == 1))
        if (!g[x][i].v) pre[u] = 2;
    }
    vis[x] = false;
  }
}
int read() {
  int tem = 0;
  char c;
  while (c = getchar(), c < '0' || c > '9')
    ;
  while (tem = tem * 10 + c - '0', c = getchar(), c >= '0' && c <= '9')
    ;
  return tem;
}
int main() {
  n = read();
  m = read();
  k = read();
  for (i = 1; i <= m; i++) {
    x = read();
    y = read();
    c = read();
    g[x].push_back(edge(y, c, false));
    g[y].push_back(edge(x, c, false));
  }
  for (i = 1; i <= k; i++) {
    qq[i] = read();
    s[i] = read();
    g[1].push_back(edge(qq[i], s[i], true));
  }
  spfa();
  ans = 0;
  memset(vis, false, sizeof(vis));
  for (i = 1; i <= k; i++)
    if ((s[i] > dis[qq[i]] || ((s[i] == dis[qq[i]]) && (pre[qq[i]] != 1))) ||
        (vis[qq[i]]))
      ans++;
    else
      vis[qq[i]] = true;
  printf("%d\n", ans);
  return 0;
}
