Can I get HIV or hep if someone in contact with infected blood scratched me. Can nail harbour the virus?

No... From your description, your risk of contracting HIV for Hepatitis are exceedingly low/non-existent. "Someone who had contact with infected blood scratched you"? I can't come up with any way (short of some bloody horror movie scene) where that would be of concern. Clean your scratch and relax.