We have three equations, Eq1, Eq2, Eq3.
Eq1  rsa = r * s * a
Eq2  r_s_a = r + s + a
Eq3  rs_ra_sa = r * s + r * a + s * a
1.Factor Eq3 for r
   rs_ra_sa = r * (s + a) + s * a
2. Rewrite Eq1 + Substitute: 
    rsa = r * s * a     s * a = rsa/r      rs_ra_sa = r * (s + a) + rsa/r 
3. Rewrite Eq2 + substitute
    s + a = r_s_a -r        rs_ra_sa = r * (r_s_a -r) + rsa/r 
4. Rewrite  
    rs_ra_sa = r * (r_s_a -r) + rsa/r      rs_ra_sa = -r^2 + r * r_s_a + rsa/r      -r^2 + r * r_s_a + rsa/r  - rs_ra_sa = 0     -r^3 + r^2 * r_s_a - rs_ra_sa *r + rsa = 0
4. Now we can solve the cubic equation using sympy to find r, s, a. They are the three roots of this equation as all previous rewriting were symmetric and could have been done also with "s" and "a".
from sympy import var, Eq, solve
```pythonfrom sympy import var, Eq, solvea = -1 b = r_s_ac = -rs_ra_sad = rsax = var('x')sol = solve(Eq(a*x**3 + b*x**2 + c*x + d, 0), x)print(sol)r, s, a = sol```
Now we can compute d and solve the challenge:
```pythonfrom sympy import mod_inverse
phi = (r-1) * (s-1) * (a-1)d = mod_inverse(e, phi)
flag_enc = pow(flag_enc, d, rsa)print(int.to_bytes(flag_enc, 54))```Solution:srdnlen{W3lc0m3_t0_srdnlen_ctf_2023_crypt0_ch4ll3ng3s}
