#define led 0
#define pa 21
#define pb 22
#define pc 23
#define pd 18

bool y;

void setup(){
  pinMode(led, OUTPUT);
  pinMode(pa, INPUT);
  pinMode(pb, INPUT);
  pinMode(pc, INPUT);
  pinMode(pd, INPUT);
}

void loop(){
  // y = A'B' + ABC'
  y = !digitalRead(pa) && !digitalRead(pb) ||
  digitalRead(pa) && digitalRead(pb) && !digitalRead(pc);
  digitalWrite(led, y);
}