Need solution to a moderately complex maths problem

Sure:

The math expression node doesn’t work with blueprintue.com so just copy it from the image above.