#!/usr/bin/env python total = 0 with open("inputd2.txt", "r") as f: for line in f: dimensions = sorted([int(x) for x in line.split("x")]) l = dimensions[0] w = dimensions[1] h = dimensions[2] total += (2 * l) + (2 * w) + (l * w * h) print(total)