import java.util.Scanner;
public class Main {
   public static void main(String[] args) {
       Scanner scanner = new Scanner(System.in);
       int math = scanner.nextInt();
       int history = scanner.nextInt();
       int geometry = scanner.nextInt();
       //ваш код
      int  time = 60;
      int result  = math + history + geometry;
      int x  = result / time;
      int y = result % time;
             System.out.println(x);
             System.out.println(y);
   }
}