There are two piles of balls, A and B. There are more small balls in pile A than pile B, and the number of balls in pile A is more than 560, but not more than 640. Take out the same number of balls from pile A as pile B and put them into pile B; for the second time, take out balls from pile B Put as many balls as the rest of pile A into pile A;  …. Continue in this way, after moving five times, it is found that there are as many small balls in pile A and pile B, then, how many small balls are there in pile A?
有甲、乙两堆小球．甲堆小球比乙堆多，而且甲堆球数比560多，但不超过640，从甲堆拿出与乙堆同样多的球放入乙堆中；第二次，从乙堆拿出与甲堆剩下的同样多的球放到甲堆中；…．如此继续下去，挪动五次以后，发现甲、乙两堆的小球一样多，那么，甲堆原有小球多少个？
<result>602</result>