pro add,seq,dark,first,last,tot

exten='.0000' & dark=strtrim(string(dark),2)	;get name of dark
strput,exten,dark,5-strlen(dark)
fzrd,seq+exten,dk				;read dark
exten='.0000' & imno=strtrim(string(first),2)	;get name of first image
strput,exten,imno,5-strlen(imno)
fzrd,seq+exten,tot & tot=float(tot-dk) & tv,tot	;read first im. & dark correct
for i=first+1,last do begin			;loop over image series
  imno=strtrim(string(i),2)
  strput,exten,imno,5-strlen(imno)
  fzrd,seq+exten,img & img=img-dk & tv,img	;read image and dark correct
  tot=tot+float(img)
endfor

end

