// Arup Guha
// 8/29/2011
// trains problem

#include <stdio.h>

int main() {

    int distance;
    int rate1, rate2;

    // Prompt user for information
    printf("What is the distance between trains in miles?");
    scanf("%d", &distance);

    printf("What is the speed of the first train in miles per hour?");
    scanf("%d", &rate1);

    printf("What is the speed of the second train in miles per hour?");
    scanf("%d", &rate2);

    double time_hr = distance/(rate1+rate2);

    printf("It will take %.3lf minutes for the trains to meet.\n", time_hr*60);

    double d1 = rate1*time_hr;
    double d2 = rate2*time_hr;

    printf("The first train will travel %.2lf miles.\n", d1);
    printf("The second train will travel %.2lf miles.\n", d2);

    return 0;
}
