How can I simplify this calculation in Python for better readability

join shbcf.ru