import decimal


def accounting(s: str) -> decimal.Decimal:
	"""Parse a string using accounting format (parenthesis for neg amounts)."""
	s = s.strip()
	if not s or s == '-':
		return decimal.Decimal(0)
	if s[0] == '(' and s[-1] == ')':
		s = '-' + s[1:-1]
	return decimal.Decimal(s)