Divide bonus amount in equal ratio based on condition provided


I am not sure if this is the right place to post this. I recently got a problem that I was not able to solve at all. I am hoping anyone can help me in figuring out the way.

Problem - ‘’’
Given 2 data set
- Employee (EmpID, Name, DepartmentId, CurrentSalary) employee.csv
E1, John, D1, 9000
E2, Doug, D1, 7000
E3, Ricky, D2, 3000
E4, Mina, D2, 2000
- Employee Historical Performance (EmpID, Year, Rating) performance.csv
E1, 2021, C
E2, 2021, A
E3, 2021, B
E4, 2021, A
Given total profit, and current year (2021), need to find bonus allocation for each employee.
- Based on employee rating, the employee’s bonus % will be decided.
- % Bonus of A = 2(% Bonus of B) = 3(% Bonus of C)

Output : [('E1', 12000.0), ('E2', 28000), ('E3', 6000.0), ('E4', 8000.0)]

Tricky part - Not allowed to use any third-party library to solve linear equations.

employee_data = [('E1','John','D1',9000), ('E2','Doug','D1',7000), ('E3','Ricky','D2',3000), ('E4','Mina','D2',2000)]
performance_data = [('E1','2021','C'), ('E2','2021','A'), ('E3','2021','B'), ('E4','2021','A')]

total_bonus = 54000
year = '2021'

def get_employee_bonus(employee_data, performance_data, total_bonus, year):       

Any clues on this are appreciated, Thanks!