sum1=0

1501.times{|i| 
if (i%3 ==0) or (i%7 ==0) 
   sum1=sum1+i 
end 
}
puts sum1
