#include <bits/stdc++.h>
using namespace std;
int n, m, k;
using ll = long long;
class Data {
 public:
  int start;
  int end;
  int reStart;
  ll coin;
  Data() : start(-1) {}
  Data(int start, int end, int reStart, int coin, int idx)
      : start(start), end(end), reStart(reStart), coin(coin) {}
};
bool operator<(const Data& d1, const Data& d2) {
  if (d1.coin < d2.coin)
    return true;
  else if (d1.coin == d2.coin) {
    return d1.reStart < d2.reStart;
  }
  return false;
}
ll cache[204][100004];
Data maxCoin[100004];
ll Solve(ll remain, ll time) {
  if (time > n) return 0;
  ll& ret = cache[remain][time];
  if (ret != -1) return ret;
  if (maxCoin[time].start == -1) return ret = Solve(remain, time + 1);
  if (remain > 0)
    return ret = min(
               Solve(remain - 1, time + 1),
               Solve(remain, maxCoin[time].reStart + 1) + maxCoin[time].coin);
  return ret = Solve(remain, maxCoin[time].reStart + 1) + maxCoin[time].coin;
}
vector<Data> v[100004];
int main(int argc, const char* argv[]) {
  cin >> n >> m >> k;
  for (int i = 0; i < k; i++) {
    int start, end, reStart, coin;
    cin >> start >> end >> reStart >> coin;
    v[start].push_back(Data(start, end, reStart, coin, i));
  }
  memset(cache, -1, sizeof(cache));
  priority_queue<Data> pq;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < v[i].size(); j++) {
      pq.push(v[i][j]);
    }
    Data d;
    d.start = -1;
    while (!pq.empty()) {
      Data tmp = pq.top();
      if (tmp.end >= i) {
        d = tmp;
        break;
      } else {
        pq.pop();
      }
    }
    maxCoin[i] = d;
  }
  cout << Solve(m, 1) << endl;
}
