A train is traveling at a constant speed from city A to city B. Along this trip the train makes three one-hour stops and reaches city B. At city B the train is stopped again for 1 hour. After that the train makes the return trip from city B to city A at a constant speed which is twice the speed of the first trip. Along this return trip the train makes ten thirty minutes stops and reaches city A. If both trips took the same amount of time, how many hours was the roundtrip?