Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n, k = map(int, input().split())
- used = [0 for i in range(n)]
- for i in range(k):
- a, b = map(int, input().split())
- a -= 1
- for j in range(a, n, b):
- used[j] = 1
- cnt = 0
- for i in range(n):
- if(used[i] and i % 7 < 5):
- cnt += 1
- print(cnt)
Advertisement
Add Comment
Please, Sign In to add comment