l=0
ml=0
n=int(input())
for i in range(n):
l=l+int(input())
ml=ml+int(input())
l=l+int(ml/1000);
ml=ml%1000;
print(l)
print(ml)
ml=0
n=int(input())
for i in range(n):
l=l+int(input())
ml=ml+int(input())
l=l+int(ml/1000);
ml=ml%1000;
print(l)
print(ml)
No comments:
Post a Comment