Spadework 2020. 2. 3. 22:26

* Solved 기준 브론즈3 단순 풀이

print(sum(map(lambda e: int(e[1])%int(e[0]), [input().split() for _ in range(int(input()))])))