#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("-ffloat-store")
using namespace std;
clock_t time_p = clock();
void aryanc403() {
  time_p = clock() - time_p;
  cerr << "Time Taken : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}
const long long int INF = 0xFFFFFFFFFFFFFFFL;
long long int seed;
mt19937 rng(seed = chrono::steady_clock::now().time_since_epoch().count());
inline long long int rnd(long long int l = 0, long long int r = INF) {
  return uniform_int_distribution<long long int>(l, r)(rng);
}
class CMP {
 public:
  bool operator()(pair<long long int, long long int> a,
                  pair<long long int, long long int> b) {
    return !(a.second < b.second ||
             (a.second == b.second && a.first >= b.first));
  }
};
void add(map<long long int, long long int> &m, long long int x,
         long long int cnt = 1) {
  auto jt = m.find(x);
  if (jt == m.end())
    m.insert({x, cnt});
  else
    jt->second += cnt;
}
void del(map<long long int, long long int> &m, long long int x,
         long long int cnt = 1) {
  auto jt = m.find(x);
  if (jt->second <= cnt)
    m.erase(jt);
  else
    jt->second -= cnt;
}
bool cmp(const pair<long long int, long long int> &a,
         const pair<long long int, long long int> &b) {
  return a.first < b.first || (a.first == b.first && a.second < b.second);
}
const long long int mod = 1000000007L;
const long long int maxN = 100000L;
long long int T, n, i, j, k, in, cnt, l, r, u, v, x, y, ans;
long long int m;
string s;
vector<pair<long long int, long long int> > a, e[maxN + 5];
long long int d[maxN + 5];
priority_queue<pair<long long int, long long int>,
               vector<pair<long long int, long long int> >, CMP>
    pq;
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  {
    cin >> n >> m >> k;
    a.clear();
    a.reserve(k);
    for (i = 0; i < (m); ++i) {
      cin >> x >> y >> in;
      e[x].push_back({y, in});
      e[y].push_back({x, in});
    }
    for (i = (1); i <= (n); ++i) d[i] = INF;
    d[1] = 0;
    for (i = 0; i < (k); ++i) {
      cin >> x >> in;
      a.push_back({x, in});
      pq.push({-x, in});
    }
    for (auto x : e[1]) pq.push({x.first, x.second});
    while (!pq.empty()) {
      auto z = pq.top();
      pq.pop();
      long long int u = abs(z.first);
      if (d[u] <= z.second) {
        ans += (z.first < 0);
        if (z.first < 0)
          ;
        continue;
      }
      d[u] = z.second;
      for (auto x : e[u]) pq.push({x.first, x.second + z.second});
    }
    cout << ans << "\n";
  }
  aryanc403();
  return 0;
}
