X borrowed a certain sum from Y at a certain rate of simple interest for 2years. He lent this sum to Z at the same rate of interest compounded annually for the same period. At the end of two years he received $4200 as compound interest but paid $4000 only as simple interest. Find the sum and rate of interest.