// NOTE: it is recommended to use this even if you don't understand the following code.

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

#define MAXM 200000

int       K, M, N, i;
int       E[MAXM], L[MAXM], R[MAXM], S[MAXM];
long long X;

int main() {
    // uncomment the two following lines if you want to read/write from files
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    assert(3 == scanf("%d%d%d", &N, &K, &M));

    for (i = 0; i < M; ++i)
        assert(4 == scanf("%d%d%d%d", &L[i], &R[i], &S[i], &E[i]));

    X = 0;


    // INSERT YOUR CODE HERE


    printf("%lld\n", X);

    return 0;
}
