```python
import re


def dose_totals(log: list) -> dict:
    """Exact per-reagent totals of a pour log, counted in thousandths."""
    thousandths = {}
    places = {}
    for reagent, amount in log:
        written = re.fullmatch(r"-?\d+(?:\.(\d{1,3}))?", amount)
        if written is None:
            raise ValueError("amount is not a decimal of at most three places: " + amount)
        digits = written.group(1) or ""
        sign = -1 if amount.startswith("-") else 1
        bare = amount.replace("-", "").replace(".", "")
        thousandths[reagent] = thousandths.get(reagent, 0) + sign * int(bare) * 10 ** (3 - len(digits))
        places[reagent] = max(places.get(reagent, 0), len(digits))
    totals = {}
    for reagent, total_thousandths in thousandths.items():
        finest = places[reagent]
        if total_thousandths < 0:
            negative = True
            total_thousandths = -total_thousandths
        else:
            negative = False
        integer_part = total_thousandths // 1000
        fractional_part = total_thousandths % 1000
        if finest == 0:
            formatted = str(integer_part)
        else:
            frac_str = str(fractional_part).zfill(3)
            # Trim trailing zeros up to the finest place
            trimmed = frac_str[:finest]
            formatted = f"{integer_part}.{trimmed}"
        if negative:
            formatted = "-" + formatted
        totals[reagent] = formatted
    return totals
```