Let the distance from house to barn be L. Distance = speed*time, so
L = 300*t1 (1) where t1 is time to get from house to barn
L = 400*t2 (2) where t2 is time to get from barn to house
t1 + t2 = 7 (3)
From (1) and (2) we have 300*t1 = 400*t2 so, dividing both sides by 400 we have t2 = 3*t1/4. Put this into (3) to get:
t1 + 3*t1/4 = 7 or 7*t1/4 = 7 or t1 = 4
t1 is the time they crawled, so crawling time = 4 minutes.