# Dynamic Array

lastAns = 0

def query_reader(queries, n):
    for i range(n):
        if queries[i][0] = 1:


def query_two

# Import the data into a matrix
n, q = [int(i) for i in raw_input().strip().split(' '))]
row = 0
queries = []
while row < q:
    queries.append([int(i) for i in raw_input().strip().split(' ')])
    row += 1

seqList = [[] for i in range(n)]

# Call function with imported data

print sum_hourglasses(data)



