from typing import Optional


def res_to_q(res: float) -> Optional[float]:
	"""
	:param res: resonance value
	:return: Q factor, or None if res out of range [0, 1)
	"""
	if not 0.0 <= res < 1.0:
		return None
	return 1.25 / (1 - res) - 1