A train, an hour after starting, meets with an accident which detains it a half hour, after which it proceeds at 34 of its former rate and arrives 312 hours late. Had the accident happened 90km farther along the line, it would have arrived only 3 hours late. The length of the trip in km was: