Header as is.. trailer count

i have .DAT file FILE1.DAT

1200910270040625
2123456789 J123456 ABC
2123456789 K123456 ABC
2222222222 L123456 DEF
2333333333 M12345 GHI
30000004
 

My outfile FILE2.TXT should have like this, I need the header value as ie (1200910270040625 ) body rows remove the duplicate rows and the trailer it should have the total count of the body records ie 3 body records the trailer value should be 30000003

1200910270040625
2123456789 J123456 ABC
2222222222 L123456 DEF
2333333333 M12345 GHI
30000003

thankz

awk '
  NR == 1 { print; next }
  NF == 1 { exit }
  !x[$1]++ { print; ++total }
END { printf "3%07d\n", total }
' "$file"

awk 'NR>1 && NF{c++}1 END{ printf "3%07d\n",c}' file