# Problem on finding the set of biases and weights in a specific neural network

I have a doubt regarding an exercise here. Suppose that we have a neural network that tries to map a $$28\times 28$$ image of a digit to what digit it actually represents. So we have a neural network like this:

The activation function is calculated for each output neuron and the neuron with the highest activation value ends up "firing" (i.e. if output neuron 1 has the highest activation function value, then the model thinks the digit is 1).

With that background, here's the actual problem:

There is a way of determining the bitwise representation of a digit by adding an extra layer to the three-layer network above. The extra layer converts the output from the previous layer into a binary representation, as illustrated in the figure below. Find a set of weights and biases for the new output layer. Assume that the first $$3$$ layers of neurons are such that the correct output in the third layer (i.e., the old output layer) has activation at least $$0.99$$, and incorrect outputs have activation less than $$0.01$$.

So here I'm assuming the "perceptron rule", i.e. the following activation function for the final layer:

$$y^{(i)} = 0$$ if $$(b + \sum_jw^{(i)}_jx_j) \leq 0$$

$$y^{(i)} = 1$$ if $$(b + \sum_jw^{(i)}_jx_j) > 0$$

where $$j \in \{0,1,2,\ldots,9\}$$ and $$i \in \{1,2,3,4\}$$. Since $$x_i < 0.01$$ for any incorrect output, I guess the weight $$w^{(i)}_j=1$$ if the $$i$$-th bit in the binary representation of digit $$j$$ is $$1$$. As an example, since $$9$$ is $$1001$$ in binary, $$w^{(1)}_9=w^{(4)}_9=1$$ and $$w^{(2)}_9=w^{(3)}_9=0$$.

In that scenario, the maximum number of digits that have $$1$$ in any of the $$4$$ bits is $$5$$ - that's because the $$4$$-th bit of $$1,3,5,7,9$$ is $$1$$. A worst case scenario is if the actual digit is $$6$$, so $$x_6 \geq 0.99$$ and all other $$x_i$$'s $$<0.01$$. Also, $$w^{(1)}_6 =w^{(3)}_6= w^{(5)}_6=w^{(7)}_6=w^{(9)}_6=1$$, which means $$\sum_jw^{(i)}_jx_j$$ is only slightly less than $$0.05$$, meaning that the bias term $$b=-0.05$$.

Is this approach/answer correct? I'm not sure if I'm missing something here. Thanks in advance!