import math


def calc_power(volts, amps, pf):
  """
    Returns tuple of (p, q, s) powers from the inputs.
  """
  try:
    s = volts * amps
    p = s * pf
    q = math.sqrt(s**2 - p**2)
    return (p, q, s)
  except (ValueError, TypeError):
    return (None, None, None)