Dwayne wants to attend more group exercise classes at his gym. This week, he plans to attend 4 cardio classes and 5 weightlifting classes, which will last a total of 377 minutes. Next week, he hopes to attend 4 cardio classes and 3 weightlifting classes, which will last a total of 303 minutes. Given that all cardio classes and all weightlifting classes are the same length, how long is each class?