def main():

    print('No' if int(input())%6 else 'Yes')

if __name__ == '__main__':
    main()