#include <bits/stdc++.h>
using namespace std;
const double PI = 2.0 * acos(0.0);
const double EPS = 1e-9;
int cases = 1;
double getdist(pair<int, int> a, pair<int, int> b) {
  return sqrt(pow((double)a.first - b.first, 2) +
              pow((double)a.second - b.second, 2));
}
struct type {
  int u, number;
  long long cost;
  type() {}
  type(int a, long long b, int d) {
    u = a;
    cost = b;
    number = d;
  }
};
struct node {
  int u;
  long long w;
  node() {}
  node(int a, long long b) {
    u = a;
    w = b;
  }
  bool operator<(const node& p) const { return w > p.w; }
};
int N, M, K;
vector<type> graph[100005];
bool vis[100005], Nodevis[100005];
long long dist[100005];
pair<int, int> par[100005];
void read(void) {
  int u, v, k;
  scanf("%d %d %d", &N, &M, &K);
  for (int i = 0; i < M; ++i) {
    scanf("%d %d %d", &u, &v, &k);
    graph[u].push_back(type(v, (long long)k, -1));
    graph[v].push_back(type(u, (long long)k, -1));
  }
  for (int i = 0; i < K; ++i) {
    scanf("%d %d", &v, &k);
    graph[1].push_back(type(v, (long long)k, i));
    graph[v].push_back(type(1, (long long)k, i));
  }
  return;
}
void DIJKSTRA(void) {
  for (int i = 2; i <= N; ++i) dist[i] = 1LL << 40;
  priority_queue<node> Q;
  Q.push(node(1, dist[1]));
  par[1] = make_pair(-1, -1);
  type v;
  while (!Q.empty()) {
    int u = Q.top().u;
    Q.pop();
    if (Nodevis[u]) continue;
    Nodevis[u] = true;
    for (int i = 0; i < (int)graph[u].size(); ++i) {
      v = graph[u][i];
      if (dist[v.u] > dist[u] + v.cost) {
        dist[v.u] = dist[u] + v.cost;
        par[v.u] = make_pair(u, v.number);
        Q.push(node(v.u, dist[v.u]));
      } else if (dist[v.u] == dist[u] + v.cost and par[v.u].second != -1 and
                 v.number == -1) {
        par[v.u] = make_pair(u, v.number);
      }
    }
  }
  return;
}
int solve(void) {
  int cnt = 0;
  for (int i = 1; i <= N; ++i) {
    if (par[i].second != -1) vis[par[i].second] = true;
  }
  for (int i = 0; i < K; ++i) cnt += vis[i] == 0;
  return cnt;
}
int main() {
  int test;
  read();
  DIJKSTRA();
  cout << solve() << "\n";
  return 0;
}
