Imports System.Console
Imports System.Environment
Module Module1
    Sub Main()
        Dim X As Integer = ReadLine()
        Dim a As Integer = X
        Dim K As Integer
        Do Until a = 0
            K += 1
            a += X
            a = a Mod 360
        Loop
        WriteLine(K + 1)
    End Sub

End Module