Mayers century helps West Indies reach 340-4 in second Bangladesh Test