Limits 1s, 512 MB

There are two hills in Sonargaon. The heights of them are H1 and H2 meter. The distance between the two hills is D meter. Two supermen are on the top of the two hills. Now they want to meet each other on the ground. But there is a problem. Both of them want to cover as minimum distance as possible. Now your task is to find the distance each of them will cover. Let, one superman will go A1 distance and the other will go A2 distance. You have to minimize A1 , A2 and the summation of (A1 + A2). To minimize A1 and A2 means the absolute difference |A1-A2| will be minimum.

This is a companion discussion topic for the original entry at https://toph.co/p/lazy-supermen