#include "head.h"
void setup() {
init();
}
void loop() {
//char x,y,z,n=7;
volatile long k, value;
unsigned char index;
//unsigned char current_state=0;
int data[8]={0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
while(1)
{
if(value=input()){
for(int i=0; i<8; i++){
if(data[i]==value)
index=i;
}
if((value & 0x80) == 0x80){
out(data[0]);
for(k=0; k<50000; k++);
out(0);
}
else{
out(data[7-index]);
for(k=0; k<50000; k++);
out(0);
}
}
}
}