[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reada f = stdin.ReadLine().Split() |> Array.map f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

[<EntryPoint>]
let main _ =
    let [M1;D1] = reads int
    let [M2;D2] = reads int
    if D2 = 1 then
        printfn "1"
    else
        printfn "0"
    0