#include <bits/stdc++.h>
using namespace std;
long long n, i, j, k, l, sum = 0, ans = 0, m, optimal[100005];
vector<long long> add[100005], remv[100005];
long long dp[100005][205];
struct enve {
  long long start;
  long long end;
  long long delay;
  long long weight;
} enve[100005];
long long f(long long pos, long long rem) {
  if (pos > n) return 0;
  if (dp[pos][rem] != -1) return dp[pos][rem];
  long long ans = 1e17, flag = 0;
  if (rem) {
    ans = min(ans, f(pos + 1, rem - 1));
  }
  if (optimal[pos] != -1) {
    ans = min(ans,
              f(enve[optimal[pos]].delay + 1, rem) + enve[optimal[pos]].weight);
  } else {
    ans = min(ans, f(pos + 1, rem));
  }
  return dp[pos][rem] = ans;
}
void solve() {
  memset(dp, -1, sizeof dp);
  cin >> n >> m >> k;
  for (long long i = 0; i < k; i++) {
    cin >> enve[i].start >> enve[i].end >> enve[i].delay >> enve[i].weight;
    add[enve[i].start].push_back(i);
    remv[enve[i].end + 1].push_back(i);
  }
  set<pair<pair<long long int, long long int>, long long>> s;
  for (long long i = 1; i <= n; i++) {
    for (auto j : add[i]) {
      s.insert({{enve[j].weight, enve[j].delay}, j});
    }
    for (auto j : remv[i]) {
      s.erase(s.find({{enve[j].weight, enve[j].delay}, j}));
    }
    if (s.size()) {
      optimal[i] = (*s.rbegin()).second;
    } else
      optimal[i] = -1;
  }
  cout << f(1, m) << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
