Synthesis of pteridines fused to heterocycles