Dynamical ejecta of neutron star mergers with nucleonic weak processes I: Nucleosynthesis