#version 1
num=1
sum=0
while num<=1000:
    if num%3==0:
        sum+=num
        print(num,sum)
    else: pass
    num+=1


#version 2
num=0
sum=0
while num<1000:
    num=num+1
    if num%3==0:
        sum=sum+num
        print(num,sum)
    else: pass


#version 3
num=0
sum=0
while num<1000:
    num=num+1
    print(num)
    if num%3==0:
        sum=sum+num
        print(sum)
    else: pass

