I have no idea how you can do the math on "failed all 3 exams and am barely passing". That doesn't really seem to make a whole ton of sense. It also seems mathematically challenging to fail 3 out of 4 exams and get a B in a class, never mind the extremely low likelihood that someone who has failed 3 exams will do extremely well on the last exam.
#1 Withdraw if possible. You are clearly unprepared for this class.
#2 Get help in person, as soon as possible. Seek out the academic resources that your school provides. Undergrad is not about learning chemistry. It is about learning how to learn. And you are failing at that, even if you get a B in gen chem.