X = int(input()) # 영수증 총 금액
N = int(input()) # 물건 종류의 개수
c = 0
for i in range(N):
a, b = map(int,input().split())
c += (a*b)
if c==X:
print('Yes')
else:
print('No')
어렵지 않게 풀 수 있었지만
챗지피티의 도움을 받아 아래처럼 수정할 수도 있겠다.
if c==X:
print('Yes')
else:
print('No')
# 이부분을 아래와 같이
print('Yes' if calculated_total == total else 'No')