Those symbols mean that your iMac is looking for the wireless keyboard and mouse.
If you can't connect your Magic Keyboard, Magic Mouse, or Magic Trackpad to your Mac - Apple Support
If you have the newer rechargeable magic keyboard and mouse..?
Try turning them off and then back on. If that does not help. plug the keyboard into to computer and plug the mouse in for 10 minutes then unplug.
If you have the older AA battery power keyboard and mouse..?
Dig out, borrow or buy a USB keyboard and mouse. Plug those into the iMac. then use them to login and reconnect your AA battery powered keyboard and mouse.