#include<iostream>
using namespace std;
int main()
{
int bc, bk, bt, bkon, bo,bp , chc chk, cht, chkon, cho,chp;
cin>>bc>>bk>>bt>>bkon>>bo>>bp>>chc>>chk>>cht>>chkon>>cho>>chp;
if (bc>1) {
    bc=(bc-1)--
        cout<<bc;
        } else if (bc<1)  {
            cout<<1<<endl;
        } else {cout<<0<<endl;}
if (bk>1) {
    bk=(bk-1)--;
        cout<<bc;
        } else if (bk<1)  {
            cout<<1<<endl;
        } else {cout<<0<<endl;}
        if (bt>1) {
    bt=(bt-2)--;
        cout<<bt;
        } else if (bt<2)  {
            cout<<bt<<endl;
        } else {cout<<0<<endl;}
        if (bkon>1) {
    bkon=(bkon-2)--
        cout<<bkon;
        } else if (bkon<2)  {
            cout<<2-bkon<<endl;
        } else {cout<<0<<endl;}
        if (bo>1) {
    bo=(bo-2)--
        cout<<bo;
        } else if (bo<2)  {
            cout<<2-bo<<endl;
        } else {cout<<0<<endl;}
        if (bc>1) {
    bp=(bp-10)--
        cout<<bp;
        } else if (bp<10)  {
            cout<<10-bp<<endl;
        } else {cout<<0<<endl;}
if (chc>1) {
    chc=(chc-1)--;
        cout<<chc;
        } else if (chc<1)  {
            cout<<1<<endl;
        } else {cout<<0<<endl;}
if (chk>1) {
    chk=(chk-1)--;
        cout<<chc;
        } else if (chk<1)  {
            cout<<1<<endl;
        } else {cout<<0<<endl;}
        if (cht>1) {
    cht=(cht-2)--
        cout<<cht;
        } else if (cht<2)  {
            cout<<bt<<endl;
        } else {cout<<0<<endl;}
        if (chkon>1) {
    chkon=(chkon-2)--
        cout<<chkon;
        } else if (chkon<2)  {
            cout<<2-chkon<<endl;
        } else {cout<<0<<endl;}
        if (cho>1) {
    cho=(cho-2)--
        cout<<cho;
        } else if (cho<2)  {
            cout<<2-cho<<endl;
        } else {cout<<0<<endl;}
        if (chc>1) {
    chp=(chp-10)--
        cout<<chp;
        } else if (chp<10)  {
            cout<<10-chp<<endl;
        } else {cout<<0<<endl;}

}