import core.bitop;
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.exception;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main ()
{
	auto a = readln.strip.to !(int);
	auto b = readln.strip.to !(int);
	auto c = readln.strip.to !(int);
	auto d = readln.strip.to !(int);
	writeln (((a ^ b) & (c | d)) ^ ((b & c) | (a ^ d)));
}
