This logic diagram of a full adder shows how logic gates can be used in a digital circuit to add two binary inputs (i.e., two input bits), along with a carry-input bit (typically the result of a previous addition), resulting in a final "sum" bit and a carry-output bit. This particular circuit is implemented with two XOR gates, two AND gates and one OR gate, although equivalent circuits may be composed of only NAND gates or certain combinations of other gates. To illustrate its operation, consider the inputs A = 1 and B = 1 with Cin = 0; this means we are adding 1 and 1, and so should get the number 2. The output of the first XOR gate (upper-left) is 0, since the two inputs do not differ (1 XOR 1 = 0). The second XOR gate acts on this result and the carry-input bit, 0, resulting in S = 0 (0 XOR 0 = 0). Meanwhile, the first AND gate (in the middle) acts on the output of the first gate, 0, and the carry-input bit, 0, resulting in 0 (0 AND 0 = 0); and the second AND gate (immediately below the other one) acts on the two original input bits, 1 and 1, resulting in 1 (1 AND 1 = 1). Finally, the OR gate at the lower-right corner acts on the outputs of the two AND gates and results in the carry-output bit Cout = 1 (0 OR 1 = 1). This means the final answer is "0-carry-1", or "10", which is the binary representation of the number 2. Multiple-bit adders (i.e., circuits that can add inputs of 4-bit length, 8-bit length, or any other desired length) can be implemented by chaining together simpler 1-bit adders such as this one. Adders are examples of the kinds of simple digital circuits that are combined in sophisticated ways inside computer CPUs to perform all of the functions necessary to operate a digital computer. The fact that simple electronic switches could implement logical operations—and thus simple arithmetic, as shown here—was realized by Charles Sanders Peirce in 1886, building on the mathematical work of Gottfried Wilhelm Leibniz and George Boole, after whom Boolean algebra was named. The first modern electronic logic gates were produced in the 1920s, leading ultimately to the first digital, general-purpose (i.e., programmable) computers in the 1940s.