from decimal import Decimal def run(filename: str) -> Decimal: with open(filename, 'r') as lines: total = Decimal(0.0) _, count, price = lines.readline().split() count = Decimal(count) price = Decimal(price) total += count * price return total if __name__ == '__main__': filename = 'Data/portfolio.dat' value = run(filename) print(f"value = {value}")