Amplitude analysis of the B0 (s)! K0K0 decays and measurement of the branching fraction of the B0! K0K0 decay