#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
const long long inf = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
struct P {
  int to;
  long long cost;
  bool operator<(const P& a) const { return cost > a.cost; }
};
int n, m;
bool vis[maxn];
long long dis[maxn];
struct node {
  int v;
  long long val;
  int sign;
  node() {}
  node(int v, long long val, int sign) {
    this->v = v;
    this->val = val;
    this->sign = sign;
  }
};
vector<node> ss[maxn];
int pre[maxn];
void Dijkstra(int s) {
  memset(vis, 0, sizeof(vis));
  fill(dis, dis + n + 1, inf);
  dis[s] = 0;
  priority_queue<P> q;
  q.push(P{s, 0});
  while (!q.empty()) {
    P p1 = q.top();
    q.pop();
    int u = p1.to;
    if (vis[u]) continue;
    vis[u] = 1;
    for (int i = 0; i < ss[u].size(); i++) {
      node pp = ss[u][i];
      int v = pp.v;
      long long val = pp.val;
      if (vis[v]) continue;
      if (dis[v] > dis[u] + val) {
        dis[v] = dis[u] + val;
        pre[v] = pp.sign;
        q.push(P{v, dis[v]});
      } else if (dis[v] == dis[u] + val) {
        if (pp.sign == 1) {
          pre[v] = pp.sign;
        }
      }
    }
  }
}
int main() {
  int k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < m; i++) {
    int a, b;
    long long val;
    scanf("%d%d%lld", &a, &b, &val);
    ss[a].push_back(node(b, val, 1));
    ss[b].push_back(node(a, val, 1));
  }
  for (int i = 0; i < k; i++) {
    int v;
    long long val;
    scanf("%d%lld", &v, &val);
    ss[1].push_back(node(v, val, 2));
    ss[v].push_back(node(1, val, 2));
  }
  Dijkstra(1);
  int cnt = 0;
  for (int i = 2; i <= n; i++) {
    if (pre[i] == 2) ++cnt;
  }
  printf("%d\n", k - cnt);
  return 0;
}
