Bit Sifting

In this problem we'll be sifting bits through sieves (sift = пресявам,
sieve = сито).
You will be given an integer, representing the bits to sieve, and
several more numbers, representing the sieves the bits will fall
through. Your task is to follow the bits as they fall down, and
determine what comes out of the other end.