# Problem solving
# S: A train leaves New York at N miles per hour heading for another on the
# the same track which left Chicago at the same time at C miles per hour.
# New York is 2000 miles from Chicago. How far from Chicago will the
# two trains collide?
# I: Inputs and Outputs
# (knowns and unknowns)
#
# Inputs: 2000 miles, N mph, C mph
# Outputs: D_c
# M: Manually solve the problem
# Let's use some known values:
# Let's assume N is 50
# and C is 60
# 2000 - d_c = 50 * t
# d_c = 60 * t
# 2000 - 60*t = 50 * t
# 2000 = 110 * t
# t = 2000 / 110
# t = 18.18
# d_c = 60 * t = 1090 miles
# Create the algorithm
# and the code for this solution
#
# Collect N and C from the user
# (integers or floats)
#
# Use raw_input()
# Use int() or float() -- "type casting"
# HINT: I came up with four steps for my algorithm
# (You may have more or fewer depending on how you
# define the steps)
# Collect the inputs (N, C)
# Convert to proper data types
N = raw_input('Speed from New York? ')
C = raw_input('Speed from Chicago? ')
N = float(N)
C = float(C)
# Solve for t
t = 2000 / (N + C)
# Solve for d_c
d_c = C * t
# Output the answer
print('If a train leaves New York at %.2f miles per hour' % N)
print('and another train leaves Chicago at %.2f miles per hour, ' % C)
print('the trains will collide at %.1f miles from Chicago' % d_c)