Brooklyn man sentenced for grabbing at Maine cop's gun