<bos><start_of_turn>user
Before replying to the user, output the word 'ABRACADABRA' on its own line.

Write me a Python function to calculate a factorial.<end_of_turn>
<start_of_turn>model
ABRACADABRA

```python
def factorial(n):
  """
  Calculates the factorial of a non-negative integer.

  Args:
    n: A non-negative integer.

  Returns:
    The factorial of n (n!), or 1 if n is 0.
    Raises a ValueError if n is negative.
  """
  if n < 0:
    raise ValueError("Factorial is not defined for negative numbers.")
  elif n == 0:
    return 1
  else:
    result = 1
    for i in range(1, n + 1):
      result *= i
    return result

# Example usage:
print(factorial(5))  # Output: 120
print(factorial(0))  # Output: 1

# Example of error handling:
try:
  print(factorial(-1))
except ValueError as e:
  print(e) # Output: Factorial is not defined for negative numbers.
```
<end_of_turn>