Agency problem and mean field system of agents with moral hazard, synergistic effects and accidents