#!/usr/bin/env python3

import csv
import sys
from decimal import Decimal


def main() -> int:
    if len(sys.argv) != 2:
        print("usage: sum_prices.py <csv-path>", file=sys.stderr)
        return 2

    total = Decimal("0")
    with open(sys.argv[1], newline="", encoding="utf-8") as handle:
        reader = csv.DictReader(handle)
        for row in reader:
            total += Decimal(row["price"])

    print(total)
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
