Kolya love put gnome circle table give coin Tanya love study triplet gnome sit vertex equilateral trianglemore formally 3n gnome sit circle each gnome 1 3 coin Lets number place order occur circle number 0 3n1 let gnome sit ith place ai coin if integer 0 in aiainai2n6 Tanya satisfy Count number way choose ai Tanya satisfied as way distribute coin print remainder number modulo 1097 two way b consider distinct index 0i3n aibi gnome get different number coin way